"chop" (string::chop)
Removes n characters from the end of the string.
Synopsis
int string.chop(int n);
Parameters
| Parameter | Description |
|---|---|
| n | Number of characters |
Description
Removes n characters from the end of the string.
If n is greater than or equal to length(), the result is an empty string; if n is negative, it is equivalent to passing zero.
Always returns 0.
Example
main()
{
string s = "ControlRoom";
s.chop(4);
DebugN(s); // "Control"
}
Console output:
WCCOAui1:["Control"]
Assignment
String
