Please enable JavaScript to view this site.

 

int = StrLength(sString)

 

This macro function returns the length (number of characters) in the string sString.

 

Spaces (including those at the front and back of the string) are counted as individual characters.

 

This function is useful when you need to perform some action based on the length of a string whose length you cannot predict ahead of time.

// what is the a-holidays string for Token date
sHolidaysCurDate = EvalToken(n_TokenDate,'[Fa]')
// how many characters in the holiday
nHolidayCharCnt = StrLength(sHolidaysCurDate)
// Does the holiday have more than 35 characters
bResult = nHolidayCharCnt > 35
// regardless of bResult replace the token by its root
sResult = '[' + s_TokenRoot + ']'

Reducing the font size or horizontal scale of the characters would be on of the possible resulting action that would be defined for the cases when bRESULT was true (ie. the holidays string had more than 35 characters).

 

See also: TextWidth.

 


Topic 110049, last updated on 19-Apr-2020