Left

Returns the leftmost substring of a string

Syntax
	KeyPgDeclareDeclare KeyPgFunctionFunction Left ( KeyPgByrefByRef str KeyPgAsAs KeyPgConstQualifierConst KeyPgStringString, KeyPgByvalByVal n KeyPgAsAs KeyPgIntegerInteger ) 
	KeyPgAsAs KeyPgStringString
	KeyPgDeclareDeclare KeyPgFunctionFunction Left ( KeyPgByrefByRef str KeyPgAsAs KeyPgConstQualifierConst KeyPgWstringWString, KeyPgByvalByVal n KeyPgAsAs KeyPgIntegerInteger ) 
	KeyPgAsAs KeyPgWstringWString

Usage
	result = Left[$]( str, n )

Parameters
	str
		The source string.
	n
		The number of characters to return from the source string.

Return Value
	Returns the leftmost substring from str.

Description
	Returns the leftmost n characters starting from the left (beginning) of 
	str. If str is empty, then the null string ("") is returned. If n <= 0 
	then the null string ("") is returned. If n > len(str) then the entire 
	source string is returned.

Example
	Dim text As String = "hello world"
	Print Left(text, 5)

	will produce the output:

	hello

An Unicode example:

dim text as wstring*20
text = "&#1055;&#1088;&#1080;&#1074;&#1077;&#1090;, &#1084;&#1080;&#1088;!"
print left(text, 6) 'displays "&#1055;&#1088;&#1080;&#1074;&#1077;&#1090;"

Platform Differences
	* DOS does not support the wide-character string version of Left.

Dialect Differences
	* The string type suffix "$" is required in the CompilerOptlang-lang qb dialect.
	* The string type suffix "$" is optional in the CompilerOptlang-lang fblite dialect.
	* The string type suffix "$" is ignored in the CompilerOptlang-lang fb dialect, warn 
	  only with the CompilerOptw-w suffix compile option (or CompilerOptw-w pedantic compile 
	  option).

Differences from QB
	* QB does not support Unicode.

See also
	* KeyPgRightRight
	* KeyPgMidfunctionMid (Function)

