ConCat
ConCat>string1,string2
Concatenates string1 with string2. String1 must be a variable containing a string. String2 can be a literal string or a variable. The result is that string1 has string2 appended to it.
Abbreviation : Con
Concat Example
Let>path=c:\temp\ ConCat>path,myfile.txtIn this example path becomes 'c:\temp\myfile.txt'
Format
Format>format_string,data,result
Formats the given data into the string provided.
Each data formatting substring starts with a % and ends with a data type indicator :
- d = Decimal (integer)
- e = Scientific
- f = Fixed
- g = General
- m = Money
- n = Number (floating)
- p = Pointer
- s = String
- u = Unsigned decimal
- x = Hexadecimal
The general format of each formatting substring is as follows:
%[-][Width][.Precision]Type
Where items in square brackets are optional.
See examples below.
Format Example
//just insert a string in a string
Let>data=45.12
Format>string is: %s,data,result
//Result becomes: "string is: 45.12"
//set floating point number to 6 decimal places
Format>%.6n,data,result
//Result becomes: 45.120000
Let>data=1234
Format>%.8d,data,result
//Result becomes: 00001234
//left padded:
Format>Padded: <%7d>,data,result
//Result becomes: "Padded: < 1234>"
//Right padded:
Format>Padded: <%-7d>,data,result
//Result becomes: "Padded: <1234 >"
//Money
Let>data=134.647
Format>Price: %m,data,result
//Result becomes: "Price: $134.65"
(currency symbol from system)
//To hex
Format>%x,324234,result
//Result becomes: 4F28A
Length
Length>string,result
Returns the length of the given string
Abbreviation : Len
See also: MidStr, Position & ConCat
Length Example
Length>Hello World,Len
LowerCase
LowerCase>string[,result]
Returns in result the lowercase version of string. If result is omitted then source string is modified.
Abbreviation : LOW
See also: UpperCase
LTrim
LTrim>string[,result]
Returns in result the string with leading spaces and control characters removed. If result is omitted then source string is modified.
Abbreviation : LTR
See also: Trim & RTrim
MidStr
MidStr>string,start,length,result
Returns a substring of specified length from a given position in a string. result is a variable in which to store the returned string. Any parameter can be a variable containing the appropriate values.
Abbreviation : Mid
See also: Position, ConCat & Length
MidStr Example
In the following example, the variable somevalue becomes equal to 'Happy' :
MidStr>Happy Birthday,1,5,somevalue
Message>somevalue
Position
Position>substring,string,start,result[,relative]
Returns the starting position of a substring in a string. The search commences at the position specified in start. If found the starting position of the substring is returned in the result variable. If no match is found this value will be zero.
If string is an empty string (length zero) or start is greater than the length of the string then the result will be zero.
The optional parameter 'relative' can be used to determine whether the position returned is relative to the start position or an absolute position in the string being searched. The default is TRUE (compatible with previous versions). Set to FALSE to return the absolute position
Abbreviation : Pos
See also: Length, MidStr, ConCat
Position Example
In this example, StartPos will contain the value 4 :
Position>Smith,Mr Smith,1,StartPos
RegEx
RegEx>pattern,text,easypatterns,matches_array,num_matches,replace_flag[,replace_string,replace_result]
Performs the regular expression in pattern on text, returning the number of sub matches in num_matches and the text found in matches_array. RegEx is compatible with the Perl 5.10 regular expression syntax using the PCRE library (http://www.pcre.org/).
matches_array is the name of a variable to store the results. The first match is stored in matches_array_1, the second in matches_array_2, etc.
To perform a replacement set replace_flag to 1 and specify the replacement string in replace_string and the return variable in replace_result. Otherwise set replace_flag to 0.
By setting easypatterns to 1 pattern can use EasyPatterns syntax. EasyPatterns uses an english-like structure to simplify the use of regular expressions. See the EasyPatterns Reference available at (http://www.datamystic.com/easypatterns_reference.html)
Abbreviation : RGX
RegEx Examples
//Find an IP address:
Let>text=This is an IP address: 192.168.10.42
Let>pattern=(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b)
RegEx>pattern,text,0,matches,num,0
MessageModal>matches_1
//Find an IP address with EasyPatterns:
Let>text=This is an IP address: 192.168.10.42
Let>pattern=[IPAddress]
RegEx>pattern,text,1,matches,num,0
MessageModal>matches_1
//Replacement:
Let>text=My Email Address: example@cyara.com
Let>pattern=[EmailAddress]
RegEx>pattern,text,1,matches,num,1,new_address@server.com,text
MessageModal>text
RTrim
RTrim>string[,result]
Returns in result the string with trailing spaces and control characters removed. If result is omitted then source string is modified.
Abbreviation : RTR
See also: Trim, LTrim
Separate
Separate>list,delimiter,returnvar
Separate takes a list, a delimiter and returns the elements of the list. The command returns a number of variables, one for each list element, each with the suffix "_n" where n is the index of the element in the list. The variable names are determined by the name given in returnvar. e.g. returnvar_1, returnvar_2, etc. Also returned is the number of elements in the list, in returnvar_count.
Abbreviation : SEP
Separate Example
GetFileList>c:\temp\*.*,files
Separate>files,;,file_names
MessageModal>Num Files: %file_names_count%
If>file_names_count=0,end
Let>k=0
Repeat>k
Let>k=k+1
Message>file_names_%k%
Until>k,file_names_count
Label>end
StringReplace
StringReplace>sourcestring,find,replace[,newstring]
Creates a new string, newstring, by searching sourcestring for all ocurrences of find, replacing them with replace.
If newstring is omitted then sourcestring is modified.
Abbreviation : RPL
See also: RegEx Position MidStr
StringReplace Example
Let>string=Your name is "Fred"
StringReplace>string,","",vbEscapedString
StringReplace>Good evening,evening,morning,newgreeting
Trim
Trim>string[,result]
Returns in result the string with leading and trailing spaces and control characters removed. If result is omitted then source string is modified.
Abbreviation : TRI
UpperCase
UpperCase>string[,result]
Returns in result the uppercase version of string. If result is omitted then source string is modified.
Abbreviation : UPP
See also: LowerCase
Comments
0 comments
Please sign in to leave a comment.