Skip to end of metadata
Go to start of metadata

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

Compare with Current View Version History

Version 1 Current »

Description

Extracts the first (left-most) "count" characters from "string". If "count" is greater than the length of string, the entire string is returned.

Functional area

String

Command syntax

Syntax

strLeft "string" count

Arguments

NameTypeRequiredComments
stringstringyesString to extract sub-string from.
countintegeryesThe number of characters to extract from string, counting from the left.

Flags

None

Return value

string

Returns the sub-string from "string".

Examples

// Extract some substrings
string $str = "This is some text";
string $subStr;

// Extract the first 7 characters
$subStr = `strLeft $str 7`;
print $subStr;
// Should be "This is"

// Extract the first 17 characters
$subStr = `strLeft $str 17`;
print $subStr;
// Should be same as $str

Additional information

Related commands

  • No labels