String extraction

 
how could I extract only the text DB0F64EEC7A2A454E798BF69494A9ACB from TerminalInfoString(TERMINAL_DATA_PATH) ?


TERMINAL_DATA_PATH = C:\Users\.........\AppData\Roaming\MetaQuotes\Terminal\ DB0F64EEC7A2A454E798BF69494A9ACB


 
Guilherme Guimaraes:
how could I extract only the text DB0F64EEC7A2A454E798BF69494A9ACB from TerminalInfoString(TERMINAL_DATA_PATH) ?


TERMINAL_DATA_PATH = C:\Users\.........\AppData\Roaming\MetaQuotes\Terminal\ DB0F64EEC7A2A454E798BF69494A9ACB


StringSplit by backslash..get the last element
 
Sardion Maranatha:
StringSplit by backslash..get the last element

Would you help me, returns code error?

string to_split=TerminalInfoString(TERMINAL_DATA_PATH);   // A string to split into substrings
   string sep="Terminal\";                // A separator as a character
   ushort u_sep;                  // The code of the separator character
   string result[];               // An array to get strings
   //--- Get the separator code
   u_sep=StringGetCharacter(sep,0);
   //--- Split the string to substrings
   int k=StringSplit(to_split,u_sep,result);
   //--- Show a comment 
   PrintFormat("Strings obtained: %d. Used separator '%s' with the code %d",k,sep,u_sep);
   //--- Now output all obtained strings
   if(k>0)
     {
      for(int i=0;i<k;i++)
        {
         PrintFormat("result[%d]=%s",i,result[i]);
        }
     }
 

He said to split by a backslash.

  1. "Terminal\" is not a backslash. It's not even valid code. Don't post code that will not even compile.

  2. A backslash is the quote character. You wrote garbage.

    Perhaps you should read the manual. Character Constants - Integer Types - Data Types - Language Basics - MQL4 Reference
       How To Ask Questions The Smart Way. 2004
          How To Interpret Answers.
             RTFM and STFW: How To Tell You've Seriously Screwed Up.

 
Guilherme Guimaraes:

Would you help me, returns code error?

string sep="\\";

you need to escape the character

 
Sardion Maranatha :

você precisa escapar do personagem

Thx! working