Edit

Share via


Text.IncStr(Text, BigInteger) Method

Version: Available or changed with runtime version 15.0.

Increases the last positive number or decreases the last negative number inside a string by the provided positive increment.

Syntax

NewString :=   Text.IncStr(String: Text, Increment: BigInteger)

Note

This method can be invoked without specifying the data type name.

Parameters

String
 Type: Text
The string that you want to increase or decrease.

Increment
 Type: BigInteger
The increment value. Only values from 1 to the max value of type BigInteger are supported.

Return Value

NewString
 Type: Text
The incremented string.

Remarks

The Text.IncStr method increases the last positive number or decreases the last negative number inside a string by the provided positive increment. The method returns a new string with the incremented or decremented value. When decreasing a positive number, you should use a try function to catch cases where the string can't be decreased further. When decreasing, leading zeros will be added as applicable.

Example

codeunit 50111 MyAccountCodeunit
{
    procedure MyIncStr()
    var
        Account: Text[60];
        ResultAccount: Text[60];
        AText: TextConst ENU = 'Account No. 99 doesn''t balance.';
    begin
        Account := AText;
        ResultAccount := IncStr(Account, 10);
    end;
}

Text data type
Getting started with AL
Developing extensions