Function Reference


StringLeft

Returns a number of characters from the left-hand side of a string.

StringLeft ( "string", count )

Parameters

string The string to evaluate.
count The number of characters to get.

Return Value

Returns a string containing the leftmost count characters of the string.

Remarks

If count exceeds string length, the entire string is returned.
If count is negative, an empty string is returned.

Related

StringCompare(), StringInStr(), StringLen(), StringLower(), StringMid(), StringReplace(), StringRight(), StringSplit(), StringTrimLeft(), StringTrimRight(), StringUpper()

Example

#include <MsgBoxConstants.au3>

Local $sString = StringLeft("This is a sentence with whitespace.", 5) ; Retrieve 5 characters from the left of the string.
MsgBox($MB_SYSTEMMODAL, "", "The 5 leftmost characters are: " & $sString)