Difference between revisions of "StrToTEA"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> function StrToTEA(const Str: string): TExtArray; </source> ==Availability== SCAR Divi 3.34 > Current ==Description== Converts ...")
 
 
(One intermediate revision by the same user not shown)
Line 8: Line 8:
  
 
==Description==
 
==Description==
Converts a [[AnsiString|string]] matching/containing the regex \d+ to a [[TExtArray]]. The regex allows for a lot of flexibility when it comes to the format of the entered string. The TExtArray can be converted back to a string with [[TEAToStr]].
+
Converts a [[AnsiString|string]] matching/containing the regex \d+(?:\.\d+)?(?:E\d+)? to a [[TExtArray]]. The regex allows for a lot of flexibility when it comes to the format of the entered string. The TExtArray can be converted back to a string with [[TEAToStr]].
  
 
==Example==
 
==Example==
Line 16: Line 16:
 
   WriteLn(TEAToStr(StrToTEA('Hello1.7,2.1,3World')));
 
   WriteLn(TEAToStr(StrToTEA('Hello1.7,2.1,3World')));
 
   WriteLn(TEAToStr(StrToTEA('1 ,2E8 3')));
 
   WriteLn(TEAToStr(StrToTEA('1 ,2E8 3')));
   WriteLn(TEAToStr(StrToTEA('1e9a2b3')));
+
   WriteLn(TEAToStr(StrToTEA('1.1e9a2b3')));
 
end.
 
end.
 
</source>
 
</source>
Line 24: Line 24:
 
  1.7,2.1,3
 
  1.7,2.1,3
 
  1,200000000,3
 
  1,200000000,3
  1000000000,2,3
+
  1100000000,2,3
  
 
==See Also==
 
==See Also==

Latest revision as of 11:32, 30 April 2012

Definition

function StrToTEA(const Str: string): TExtArray;

Availability

SCAR Divi 3.34 > Current

Description

Converts a string matching/containing the regex \d+(?:\.\d+)?(?:E\d+)? to a TExtArray. The regex allows for a lot of flexibility when it comes to the format of the entered string. The TExtArray can be converted back to a string with TEAToStr.

Example

begin
  WriteLn(TEAToStr(StrToTEA('1,2.8,3')));
  WriteLn(TEAToStr(StrToTEA('Hello1.7,2.1,3World')));
  WriteLn(TEAToStr(StrToTEA('1 ,2E8 3')));
  WriteLn(TEAToStr(StrToTEA('1.1e9a2b3')));
end.

Output:

1,2.8,3
1.7,2.1,3
1,200000000,3
1100000000,2,3

See Also