Skip to end of banner
Go to start of banner

chop

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Availability

This routine is available since katl-commons 1.0 .

Syntax:

chop(str, nmb)

Description:

Returns a string, chopped at nmb characters. Cuts down the string (if length is greater than nmb characters) to a string of max nmb chars.


Returns nmb characters from str, starting with the leftmost character.

Parameters:

Parameter name

Type

Required

Description

str

string

Yes

Specifies a character expression.

nmb

number

Yes

Specifies the number of characters returned from the character expression str.

Return type:

string

Example:

Example 1:

wret = chop("Once upon a time", 6);
print(wret);

Print Once u

Example 2:

wret = chop("Once upon a time", 30);
print(wret);

Print Once upon a time

Example 3:

wret = chop("Once upon a time", -1);
print(wret);

Print Once upon a time

See also:

 

  • No labels