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.
➢Certain internal Q++Studio markers, such as the ones generated by FormatText or the use of EvalToken with symbol tokens (Moon phases, Zodiac signs, holiday symbols, ...), are excluded from the count.
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 is one possible resulting action that could be defined for cases when bRESULT was true (ie. the holidays string had more than 35 characters).
See also: TextWidth.
Topic 110049, last updated on 17-Oct-2026