string class : RemoveFromEnd(int) method

Description

Gets a new instance of the string that have removed the specified number of characters from the end.

Syntax

stringInstance.RemoveFromEnd(int number)

Arguments

ClassNameDescription
intnumberA number of characters to delete.

Return value

ClassDescription
stringA new instance of the string that have removed the specified number of characters from the end.

Sample code

//anyString is a instance of string type.

string removedString = anyString.RemoveFromEnd(5);

Notes

This method is added in Ver 1.1.0.0.

If the argument is less than 1, an exception occurs.

If the argument is greater than the length of the calling string, an exception occurs.

Changes in Ver 1.1.1.0.

If the argument is 0, a copy of the original string is returned.

If the argument is the same as the string length, an empty string is returned.

If the argument is less than 0 or greater than the length of the calling string, an exception will be thrown.

Links for reference

None

Copyright © Rice All rights reserved.