Drug Metabolism (How long does a drug stay in your system)
What you need to do is locate the half-life of a drug. An easy way to find that is to do a search for "<drug name> physician prescribing information". Generally, the rule of thumb is 99% of the drug will be eliminated after 5 time constants or 5 times the half-life have passed.
Your particular metabolism and the length of continuous use will affect your actual elimination. Pay attention to the routes of elimination, for if you have an impairment there, it will affect it even more.
Hair Follicle Testing
A note for hair follicle testing. Basically the detection time depends on how fast your hair grows and how long it is. Your hair grows about 1/2" per month. A 90 day assay is common.