{
return 0.0f;
}
- std::unique_ptr<char[]> pFloatChar(Tizen::Base::_StringConverter::CopyToCharArrayN(floatString.GetPointer()));
- float convertFolat = atof(pFloatChar.get());
- return convertFolat;
+ float integerPart = 0.0f;
+ float decimalPart = 0.0f;
+ float multiple = 1.0f;
+ float sign = 1.0f;
+ int index = 0;
+ bool isDecimal = false;
+
+ if (floatString[index] == L'-')
+ {
+ sign = -1.0f;
+ index ++;
+ }
+ else if (floatString[index] == L'+')
+ {
+ sign = 1.0f;
+ index ++;
+ }
+
+ while (index < floatString.GetLength())
+ {
+ if (floatString[index] == L'.')
+ {
+ isDecimal = true;
+ }
+ else if (floatString[index] >= L'0' && floatString[index] <= L'9')
+ {
+ if (isDecimal)
+ {
+ decimalPart = (decimalPart * 10.0f) + (floatString[index] - L'0');
+ multiple = 0.1f * multiple;
+ }
+ else
+ {
+ integerPart = (integerPart * 10.0f) + (floatString[index] - L'0');
+ }
+ }
+ index ++;
+ }
+ decimalPart = decimalPart * multiple;
+
+ return sign * (integerPart + decimalPart);
}
static float