Converts some characters in a string.
|
NewString := CONVERTSTR(String, FromCharacters, ToCharacters)
|
Parameters
- String
-
Type: Text constant or code
The string that you want to convert.
- FromCharacters
-
Type: Text constant or code
The characters that you want to replace. This function is
case-sensitive.
- ToCharacters
-
Type: Text constant or code
The new characters you want to insert. This function is
case-sensitive.
The length of this string must correspond to the length of
FromCharacters.
Property Value/Return Value
Type: Text constant or code
The converted string.
Remarks
Example
This example requires that you create the following
variables and text constants in the C/AL Globals window.
Variable name |
DataType |
Length |
OriginalString
|
Text
|
30
|
FromChars
|
Text
|
30
|
ToChars
|
Text
|
30
|
NewString
|
Text
|
30
|
Text constant |
ENU value |
Text000
|
Do you want to leave without saving?
|
Text001
|
lws
|
Text002
|
LWS
|
Text003
|
The original sentence is:\ %1
|
Text004
|
The sentence is converted to:\ %1
|
|
Copy Code |
OriginalString := Text000;
FromChars := Text001;
ToChars := Text002;
NewString := CONVERTSTR(OriginalString, FromChars, ToChars);
MESSAGE(Text003, OriginalString);
MESSAGE(Text004, NewString);
|
The first message window shows:
The original sentence is:
Do you want to leave without saving?
The second message window shows:
The sentence is converted to:
Do you Want to Leave Without Saving?
See Also