Link Search Menu Expand Document

UString.Slice Method

Explanation Cut out a part of the character string.

This method cuts out the character string without being aware of the character type of the target character string. Use the
mid function to cut out a character string that contains double - byte characters in the target character string.

The difference with Substring method
When length is the length of a character string, if a negative value is specified for start, it will be processed as length + start.
If a negative value is specified for end, it will be processed as length + end.
Call format var s = str.Slice( start [, end ] )
Return value Cut out character string
Arguments integer start Leading position to cut out
Specify a number starting from 0.
integer end End position to cut out (cut out to the character before the specified position)
Specify a number starting from 0 . If omitted, it will be cut out to the end of the character string.
Exception Func-4 Invalid argument
Example of use
var str = new UString("abcdefg");
print(str.Slice(2, 4), "\n");
    
Related item Substring method