Difference between revisions of "StrToTEA"

From SCAR Divi Manual
Jump to: navigation, search
 
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==

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