Ask a Lawyer and Get Answers to Your Legal Questions
California has a program passed under state proposition 36 that does exactly what you are describing. The way it basically works is you are sentenced and ordered to undertake an extensive treatment program that generally lasts a year and does not include jail time. Upon successful completion, you can have the charges dismissed. Prosecutors will routinely offer Prop. 36 diversion for most first time drug-related offenses.
This website covers most of the details. Best of luck. http://www.prop36.org/faq.html#wq1
If this was informative, please click "accept" so I may receive credit for my personal time and knowledge. Thank you.