DecodeLineFeeds
The function DecodeLineFeeds decodes characters within aInputString that are specified by the aReplace characters, and converts these characters into a carriage return #13 and line feed #10.
Declaration: Function DecodeLineFeeds( aInputString : string; aReplace : string) : string;
An example follows.
procedure
OnMapEvent(
var
Value:Variant);
Var
Str1 :
string
;
begin
//Converts the given characters into a #13#10 (carriage return/line feed)
Str1 := DecodeLineFeeds(Str1,
'/n'
);;
end
;
The carriage return/line feed can be imbedded or interpreted in several ways, as is shown by the following code which uses example of both EncodeLineFeeds and DecodeLineFeeds.
Please also refer to EncodeLineFeeds.
procedure
ScriptEvent(
var
Value:Variant);
Var
Str1, Str2, Str3 :
string
;
begin
//Embeds using a plus sign (+) separator
Str1 := (
'Hello '
+#
13
+#
10
+
' World!'
);
LogInfo(Str1);
//Returns Hello World!
Str2 := (EncodeLineFeeds(Str1,
'/n'
));
LogInfo(Str2);
//Returns Hello /n World!
Str3 := (DecodeLineFeeds(Str2,
'/n'
));
LogInfo(Str3);
//Returns Hello World!
//Embeds using no separator
Str1 := (
'Hello '
+#
13
#
10
+
' World!'
);
LogInfo(Str1);
Str2 := (EncodeLineFeeds(Str1,
'/w'
));
LogInfo(Str2);
Str3 := (DecodeLineFeeds(Str2,
'/w'
));
LogInfo(Str3);
//Embeds using a plus sign (+) separator and the Chr function
Str1 := (
'Hello '
+Chr(
13
)+Chr(
10
)+
' World!'
);
LogInfo(Str1);
Str2 := (EncodeLineFeeds(Str1,
'/x'
));
LogInfo(Str2);
Str3 := (DecodeLineFeeds(Str2,
'/x'
));
LogInfo(Str3);
end
;