If you think carefully about the problems that you encounter in your programming life, you will come to realize that, like most of us, you rarely want to do anything original. Whatever you want to do, someone will have done it before. Given that, and also that a lot of programmers are show-offs, it is pretty certain that someone, at some time, will have posted about how wonderful they are and how they solved a particular problem, due entirely to their brilliance and superior coding skills.
Bearing all the above in mind, do you not think that before asking a question here, you might have been better served to have made use of a search engine, together with a suitable search phrase, in order to find one of these gems.
The worst that could happen is that you might find that
someone has asked the same question as you[
^] and that someone has answered it.