pos ( ) :integer
I think it would be useful to add an argument to the pos( ) string position search function to ignore the case. It does not seem there is a good method to search while ignoring the case.
TString IndexOf
The TString.indexOf would benefit greatly from a sub-string search, as well as the ignore case argument as described above for the pos ( ).
These two search functions if updated I believe would enhance the String Manipulation greatly in the Fastscripts.
Also,
I don't think I've ever seen a function return an array. Is this because of issues with dynamic array sizing? Can functions pass :array of integer, etc...
I was also thinking that beyond a positional search that possibly there could be
a more detailed string search. Example
--------------------------------------------------------------------------------------------------------------------
function StrSearch(source: string, sub :string, ignoreCase :bool): array of Int32;
--------------------------------------------------------------------------------------------------------------------
You could then search for the substring (sub) within the (source) text, using True to ignore the case. The result will find the first position and the last match of the sub-string and return the index positions in an array of Result [0..1].
PSEUDO
Code: Select all
var result : array [0..1] of integer;
var inputString :string;
inputString := 'This is where the password starts'';
result := StrSearch( inputString , 'Pass' , 1 );
//result[0] returns = 19 where 'p' begins regardless of case.
//result[1] returns = 22 because 'pass' ended at position 22_
//irregardless of 'password'
//Alternately, result[2] could be the count of matchesJust some ideas and suggestions I wanted to share. Doing some scripting and sometimes these things just got to write down.
-s
