Function Reference


StringTrimRight

Trims a number of characters from the right hand side of a string.

StringTrimRight ( "string", count )

Parameters

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

Return Value

Returns the string trimmed by count characters from the right.

Remarks

If count is out-of-bounds, an empty string is returned.
StringTrimRight($str, $n) is functionally equivalent to StringLeft($str, StringLen($str) - $n)

Related

StringCompare, StringInStr, StringLeft, StringLen, StringLower, StringMid, StringReplace, StringRight, StringSplit, StringTrimLeft, StringUpper

Example

#include <MsgBoxConstants.au3>

Local $sString = StringTrimRight("This is a sentence with whitespace.", 5) ; Remove the 5 rightmost characters from the string.
MsgBox($MB_SYSTEMMODAL, "", $sString)