Deletes a substring inside a string (text or code).
|
NewString := DELSTR(String, Position[, Length])
|
Parameters
- String
-
Type: Text constant or code
The input string.
- Position
-
Type: Integer
The position of the first character that you want to delete.
Position must be greater than zero
(0).
If Position exceeds the length of
String, DELSTR returns the original
string, unchanged.
- Length
-
Type: Integer
Specifies how many characters to delete. Length must be greater than zero (0).
Property Value/Return Value
Type: Text constant or code
The resulting 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 |
Str
|
Text
|
30
|
Position
|
Integer
|
|
Length
|
Integer
|
|
NewStr
|
Text
|
30
|
Text constant |
ENU value |
Text000
|
Adjusting prices - Please wait.
|
Text001
|
The original string:\>%1<
|
Text002
|
The modified string:\>%2<
|
|
Copy Code |
Str := Text000;
Position := 11; // Remove the word 'prices' and a blank
Length := 7;
NewStr := DELSTR(Str, Position, Length);
MESSAGE(Text001, Str);
MESSAGE(Text002, NewStr);
|
The first message window displays the following:
The original string:
>Adjusting prices - Please wait.<
The second message window displays the following:
The modified string:
>Adjusting - Please wait.<
See Also