Files
mql5-skills/skills/mql5/references/docs/34-standardlibrary/2121-standardlibrary-stringoperations-cstring-cstringtrim.md
T
2026-06-23 21:47:51 +08:00

40 lines
643 B
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.
# Trim
Removes all characters within a set (as well as ' ','\t','\r','\n') at both ends of a string from this string.
```
int  Trim(
   const string  targets      // set
   )
```
Parameters
targets
[in]  Set of characters to remove.
Return Value
Number of removed characters.
Example:
```
//--- example for CString::Trim
#include <Strings\String.mqh> 
//--- 
void OnStart() 
  { 
   CString str;
   //--- 
   str.Assign("   \t\tABCD\r\n");
   printf("Source string '%s'",str.Str());
   //---
   str.Trim("DA-DA-DA");
   printf("Result string '%s'",str.Str());
  } 
```