/docs/commands/StringLen.htm

http://github.com/Lexikos/AutoHotkey_L-Docs · HTML · 61 lines · 46 code · 15 blank · 0 comment · 0 complexity · 0a892913e2ec3a6b48a419d3495cfccb MD5 · raw file

  1. <!DOCTYPE HTML>
  2. <html lang="en">
  3. <head>
  4. <title>StrLen() / StringLen - Syntax &amp; Usage | AutoHotkey</title>
  5. <meta name="description" content="The StrLen function and StringLen command retrieve the count of how many characters are in a string." />
  6. <meta name="ahk:equiv-v2" content="commands/StrLen.htm" />
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  8. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  9. <link href="../static/theme.css" rel="stylesheet" type="text/css" />
  10. <script src="../static/content.js" type="text/javascript"></script>
  11. </head>
  12. <body>
  13. <h1>StrLen() / StringLen</h1>
  14. <p>Retrieves the count of how many characters are in a string.</p>
  15. <h2 id="function">StrLen()</h2>
  16. <pre class="Syntax">Length := <span class="func">StrLen</span>(String)</pre>
  17. <h3>Parameters</h3>
  18. <dl>
  19. <dt>String</dt>
  20. <dd><p>The string to be measured.</p></dd>
  21. </dl>
  22. <h3>Return Value</h3>
  23. <p>This function returns the length of the string.</p>
  24. <h3>Examples</h3>
  25. <pre class="NoIndent">InputVar := "The Quick Brown Fox Jumps Over the Lazy Dog"
  26. MsgBox % &quot;The length of InputVar is &quot; . StrLen(InputVar) <em>; Result: 43</em></pre>
  27. <h2 id="command">StringLen</h2>
  28. <p class="warning"><strong>Deprecated:</strong> This command is not recommended for use in new scripts. Use the <a href="#function">StrLen</a> function instead.</p>
  29. <pre class="Syntax"><span class="func">StringLen</span>, OutputVar, InputVar</pre>
  30. <h3>Parameters</h3>
  31. <dl>
  32. <dt>OutputVar</dt>
  33. <dd><p>The name of the variable in which to store the length.</p></dd>
  34. <dt>InputVar</dt>
  35. <dd><p>The name of the variable whose contents will be measured. Do not enclose the name in percent signs unless you want the <em>contents</em> of the variable to be used as the name.</p>
  36. </dd>
  37. </dl>
  38. <h3>Examples</h3>
  39. <pre class="NoIndent">StringLen, Length, InputVar
  40. MsgBox, The length of InputVar is %Length%.</pre>
  41. <h2>Remarks</h2>
  42. <p>If <em>String</em> or <em>InputVar</em> is a variable to which <a href="../misc/Clipboard.htm#ClipboardAll">ClipboardAll</a> was previously assigned, StrLen() or StringLen will report its total size.</p>
  43. <h2>Related</h2>
  44. <p><a href="IfInString.htm">IfInString</a>, <a href="StringGetPos.htm">StringGetPos</a>, <a href="StringMid.htm">StringMid</a>, <a href="StringTrimLeft.htm">StringTrimLeft</a>, <a href="StringTrimLeft.htm">StringTrimRight</a>, <a href="StringLeft.htm">StringLeft</a>, <a href="StringLeft.htm">StringRight</a>, <a href="StringLower.htm">StringLower</a>, <a href="StringLower.htm">StringUpper</a>, <a href="StringReplace.htm">StringReplace</a></p>
  45. </body>
  46. </html>