Instant methods: right()

The instant method right() returns the rightmost part from a string operand.

Declaration

string string.right( int32 aCount )

Parameters

aCount

Maximal number of characters to return.

Discussion

The right() method copies up to aCount final characters from the string, in context of which it has been called and returns the copied characters as a new string without modifying the original string operand. If aCount <= 0 the method returns always an empty string "". For example:

var string s1 = "green blue red"; var string result = s1.right( 3 ); // result = "red" var string result = s1.right( 8 ); // result = "blue red" var string result = s1.right( 100 ); // result = "green blue red" var string result = s1.right( -10 ); // result = ""