Strings
A string is a text (collection if character), other than a char array (e.g. char[10]
) is the size of
a string dynamic.
You can define a string either in double quotation marks ("This is a string"
) or in single quotation marks ('This is also a string'
).
More about that at string literals.
Methods
ToCharArray
This method creates a char[]
from the string.
Examples
let str: String = "Hello World!";
let charArray: char[12] = str.toCharArray;
While compiling, this method is just removed, meaning that the ABAP code look something like:
That means it is never checked, that the string fits into the char array.
charArray = str.
That means it is never checked, that the string fits into the char array.
Range Operations
With range operations, you can get a string slice or single character out of a string.
You give it the start and end index.
let str = "Hello World!";
let world = str[6..11];
let world2 = str[6..^2];
let w = str[6];