%String%    Show Routine Code    Author: Siegfried


Version: 1  -  Date: 2007-02-15

 

Example calls:
%String% "My Example String is too long" "trim=1,0"
%String% "My Example String is too long" "pick=0,1"
%String% "My Example String is too long" "rightget=4"

Remarks:

Routine to manipulate strings in various ways.

 

Returns the manipulated string as %result%

 

SubFunction

Parameter 2

Remarks

trim  "trim=1,0" trims off the left first char "trim=0,1" -> trims last char, "trim=0,3" -> trims last 3 chars
pick "pick=2,0" returns only the second char from left "pick=0,3" -> returns the third char from right

leftget

"leftget=10" returns the first 10 chars from left "leftget=4,7" returns the 7 chars starting with position four from left
rightget "rightget=10" returns the last 10 chars "rightget=4,3" returns the 3 chars starting with position 4 from right
replace "replace=long,short" replaces ocurrances of "long" with "short"  in this example.
remove "remove= is too long" removes ocurrances of " is too long" in this example.
token "token=2,\" returns "Programme" for the string "C:\Programme" ... a "FOR loop" with "tokens,delims"


More examples below:


trim

%String% "My Example String is too long" "trim=1,0"
    result is "y Example String is too long"


%String% "My Example String is too long" "trim=0,1"
    result is "My Example String is too lon"


%String% "My Example String is too long" "trim=1,1"
    result is "y Example String is too lon"

 


pick

%String% "My Example String is too long" "pick=0,1"
    result is "g"


%String% "My Example String is too long" "pick=1,0"
    result is "M" "M"


%String% "My Example String is too long" "pick=2,6"
    result is "yo"

 


leftget

%String% "My Example String is too long" "leftget=10"
    result is "My Example"


%String% "My Example String is too long" "leftget=4,7"
    result is "Example"

 


rightget

%String% "My Example String is too long" "rightget=4"
    result is "long"


%String% "My Example String is too long" "rightget=4,3"
    result is "lon"


%String% "My Example String is too long" "rightget=3,2"
    result is "on"


%String% "My Example String is too long" "rightget=20,4"
    result is "e St"


%String% "My Example String is too long" "replace=S,X"
    result is "My Example Xtring iX too long"
 

 


replace
%String% "My Example String is too long" "replace=long,short"
    result is "My Example String is too short"

 

 


remove


%String% "My Example String is too long" "remove= is too long"
    result is "My Example String"


%String% "My Example String is too long" "remove=Example "
    result is "My String is too long"


%String% "My Example String is too long" "remove= "
    result is "MyExampleStringistoolong"


%String% "C:\Programme\OO Software\Defrag Professional" "remove=C:\Programme\"
    result is "OO Software\Defrag Professional"


Actual unexpanded input was:
    "%ProgramFiles%\OO Software\Defrag Professional" "remove=%ProgramFiles%\"


 


token

%String% "C:\Programme" "token=2,\"
    result is "Programme"


%String% "C:\Programme" "token=1,:"
    result is "C"


%String% "My *Example Str=ing, is too long" "token=2,*"
    result is "Example Str=ing, is too long"


%String% "My *Example Str=ing, is too long" "token=2,="
    result is " is too long"


%String% "My *Example Str=ing, is too long" "token=2,blank"
    result is "*Example"