Difference between revisions of "StrToTPA"

From SCAR Divi Manual
Jump to: navigation, search
(Description)
(Description)
Line 8: Line 8:
  
 
==Description==
 
==Description==
Converts a [[AnsiString|string]] matching(/containing) the regex (?:(?:\()?\s*\d+\s*,\s*\d+\s*(?:\))?\s*;\s*)*(?:\()?\s*\d+\s*,\s*\d+\s*(?:\))? to a [[TPointArray]]. The regex allows for a lot of flexibility when it comes to the format of the entered string. The TPointArray can be converted back to a string with [[TPAToStr]].
+
Converts a [[AnsiString|string]] matching/containing the regex (?:(?:\()?\s*\d+\s*,\s*\d+\s*(?:\))?\s*;\s*)*(?:\()?\s*\d+\s*,\s*\d+\s*(?:\))? to a [[TPointArray]]. The regex allows for a lot of flexibility when it comes to the format of the entered string. The TPointArray can be converted back to a string with [[TPAToStr]].
  
 
==Example==
 
==Example==

Revision as of 11:07, 1 July 2011

Definition

function StrToTPA(const Str: AnsiString): TPointArray;

Availability

SCAR Divi 3.25 > Current

Description

Converts a string matching/containing the regex (?:(?:\()?\s*\d+\s*,\s*\d+\s*(?:\))?\s*;\s*)*(?:\()?\s*\d+\s*,\s*\d+\s*(?:\))? to a TPointArray. The regex allows for a lot of flexibility when it comes to the format of the entered string. The TPointArray can be converted back to a string with TPAToStr.

Example

begin
  WriteLn(TPAToStr(StrToTPA('(1,2);(3,4);(5,6)')));
  WriteLn(TPAToStr(StrToTPA('Hello(1,2);(3,4);(5,6)World')));
  WriteLn(TPAToStr(StrToTPA('(1   ,2) ;(  3 ,4 );(5  ,6)')));
  WriteLn(TPAToStr(StrToTPA('1,2;(3,4);(5,6)')));
  WriteLn(TPAToStr(StrToTPA('   1, 2;3,   4;5, 6')));
end.

Output:

(1,2);(3,4);(5,6)
(1,2);(3,4);(5,6)
(1,2);(3,4);(5,6)
(1,2);(3,4);(5,6)
(1,2);(3,4);(5,6)

See Also