Char Data Type

Use this simple data type to store a single character as a value in the range 0 to 255. You can easily convert this data type from a number to a character and vice versa. This means you can use mathematical operators on char variables as well as numeric variables.

You can assign a constant string of the length 1 to a char variable, as shown in the first line of the following code example.

You can assign a single char in a text, code, or binary variable to a char variable, as shown in the second line of the following code example.

You can assign a numeric value to a char variable as shown in the third line of the following code example. This causes the char variable to contain the character from the ASCII character set that corresponds to the numeric ASCII code.

C := 'A';
C := S[2];
C := 65;

In the Classic client, you can assign a char to any position within the defined length of a text or code variable. For example, if the value of the text variable MyText is 'abc' then you can use the following assignment.

MyText[5] := 'e';

In this case, MyText is displayed as 'abc' because the null terminator is at position 4 in MyText and signifies the end of the text string. You can then use the following assignment.

MyText[4] := 'd';

Now MyText is displayed as 'abcde' and the null terminator of the string is at position 6 in MyText.

In the RoleTailored client, you cannot assign a char to a position greater than the position of the null terminator. For example, if the value of the text variable MyText is 'abc', then the null terminator is at position 4 and the following assignment causes a run-time error to occur.

MyText[5] := 'e';

Community Additions

ADD
Show: