Files
mql5-skills/skills/mql5/references/docs/09-strings/0636-strings-stringlen.md
T
2026-06-23 21:47:51 +08:00

45 lines
1.1 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# StringLen
Returns the number of symbols in a string.
```
int  StringLen(
   string  string_value      // string
   );
```
Parameters
string_value
[in]  String to calculate length.
Return Value
Number of symbols in a string without the ending zero.
Example:
```
void OnStart()
  {
//--- define the test string
   string text="123456789012345";
//--- get the number of symbols in the string
   int str_len=StringLen(text);
//--- display the string and the number of symbols in it in the log
   PrintFormat("The StringLen() function returned the value of %d chars in string: '%s'", str_len, text);
   
   /*
   Result
   The StringLen() function returned the value of 15 chars in string: '123456789012345'
   */
  }
```
See also
[StringBufferLen](/en/docs/strings/stringbufferlen), [StringTrimLeft](/en/docs/strings/stringtrimleft), [StringTrimRight](/en/docs/strings/stringtrimright), [StringToCharArray](/en/docs/convert/stringtochararray), [StringToShortArray](/en/docs/convert/stringtoshortarray)