In this section, we will describe some of functions used to manipulate strings on FMScript.
This function generate a unique ID. two simultaneous calls of the same functions in your will return almost different values
Demo : Generate two Strings ID at the same time
var Result : String;
Result := 'Str 1 = ' + CreateStrID + LINEBREAK + 'Str 2 = ' + CreateStrID;
Exit;
copy a sub string in a chain. It takes in parameter a string (Str), the index of beginning of the copy (StartIndex), as well as the number of characters to copy in the String(NbCharacters)
Signature
Copy(Str : String, StartIndex : Integer, NbCharacters : Integer);
var Result : String;
Result := Copy('Hello FM Community', 6, 15);
Exit;
returns the size of a text passed as a parameter
Signature
Length(Value : String);
var Result : String;
Result := Copy('Hello FM Community', 6, 15);
ShowMessage(Length(Result));
Exit;
Returns 'ACount' most Left caracters of 'AStr'
Signature
LeftStr(AStr : String, ACount : Integer);
var Result : String;
Result := '1 row inserted';
IF LeftStr(Result, 1) <> '1' THEN
(
ShowMessage('Failed');
Exit;
);
ShowMessage('Succeed');
Exit;
Returns 'ACount' most Right caracters of 'AStr'
Signature
RightStr(AStr : String, ACount : Integer);
Convert all caracters of AString to their corresponding LowerCase Value
Signature
LowerCase(AString : String);
Convert all caracters of AString to their corresponding UpperCase Value
Signature
UpperCase(AString : String);
Convert only 1st caracter of AString to it corresponding Uppercase Value
Signature
UpperCaseFirst(AString : String);
Minify string like javascript or css code
Signature
MinifyString(AString : String);
Returns Quoted string of 'AStr'
Signature
QuotedStr(AStr : String);
Return a string value with edge spaces removed
Signature
Trim(Value : String);
Return respectively Slash Backward and Slash Forward string
convert caracters of to their corresponding USSD String Value
Signature
USSDStringFilter(Value : String);
Decode a UTF8 string.
Signature
UTF8ToString(Value : String);
Encode Astring to make it compatible for get method.
Signature
URLEncode(Value : String);
Decode and encoded Astring.
Signature
URLDecode(Value : String);
Mostly used to display prices.
Signature
FormatFloat(Format : String, Extended : Double);
var Result : String;
var Amount : String;
Amount := 20000;
Result := FormatFloat('#,##0.00', Amount);
ShowMessage(Result);
Exit;