maeglor: (Default)
[personal profile] maeglor
А чтобы было еще смешнее скажу, что перед единственым использованием этого творения, стоит проверка на числовое значение передаваемой строки. :)

float TSettingsChart::FmtStr(AnsiString &Value)
{
 float Result;
 AnsiString StrRes="0"; // 0, чтобы, если изображение в колонке отсутствует, привести к float.
 char buff[1];
 try
 {
   Set <char,'0','9'> D_S;
   D_S<<'0'<<'1'<<'2'<<'3'<<'4'<<'5'<<'6'<<'7'<<'8'<<'9';
   for(int i=1;i<len(Value);i++)
   {
    strcpy(buff,Value.SubString(i, 1).c_str());
    if (D_S.Contains(buff[0]) || Value.SubString(i, 1)==".")
      StrRes += Value.SubString(i, 1);
   }

   Result = StrRes.ToDouble();
 }
 catch(Exception &e)
 {
   Application->ShowException(&e);
 }
 return Result;
}
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

March 2017

S M T W T F S
   1234
5678 91011
12131415161718
19202122232425
262728293031 

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 26th, 2026 10:45 pm
Powered by Dreamwidth Studios