Hi all. I'd just like to know if theres a Latex function that i can use to retrieve the number of characters in a string. Eg:
\begin{document}
\strlen{test}
\end{document}
would print "4" on the page. Does something like that exist?
Cheers.
Text Formatting ⇒ getting the length of a string?
NEW: TikZ book now 40% off at Amazon.com for a short time.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
getting the length of a string?
This is definitely a job for the xstring package. Refer to Section 2.3 (Macros returning a number, p. 9ff) of the manual.
Best regards and welcome to the board
Thorsten
Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10