Preferred way to format a string to a number?

I use CNumberFormatter to format a floating point value according to the i18n settings for the current locale of my application. I can not find the reverse functionality; how do I convert a string containing a number formatted according to the current locale back to a floating point value?

Note that CPropertyValue::ensureFloat does not work since it does not take i18n settings into account (it is just a float cast which fails for some locales).

Maybe this is useful for someone in the future, I solved it in the following way:




(float)str_replace(Yii::app()->locale->getNumberSymbol('decimal'), '.', $f);