uniSubStr()

Cuts a string or a character of a certain length (characters) out of another string.

Synopsis

string uniSubStr( string s, int pos [, int len]);

Parameters

Parameter Description
s Original string
pos Starting position of the string to be cut out
len Number of characters to be cut out

Return value

Shortened string; if pos is greater than the length (characters) of s , if len is smaller than 1 or if any other error occurs, an empty string is returned.

Errors

missing or incorrect arguments

Description

Cuts len characters out of the string s from position pos and returns this substring. The first character of the string s is pos 0, the second character of the string is pos 1, and so forth.

If the optional parameter is omitted, the substring is returned from pos to the end of s .

Example

main()
{
  /*uniSubStr cuts a string of a certain length at a specific
  position out of another string */
  string suS = "This is a sentence with strings";
  int pos = 19;
  int len = 12;
  string b = uniSubStr(suS, pos, len);
  DebugN("The cut string:", b);
}

Assignment

Strings

Availability

CTRL