Download MetaTrader 5

Need a simple coding help - Get File Name + String to Integer....!

To add comments, please log in or register
ArikKarish
43
ArikKarish  

Hii guys it would be awesome if you can help me out here,


i need to get the EA file name and remove the strings from its name and have the final result in only numbers,

EXAMPLE:

EA name is "JOHNCORE 112.32231"

we need to get the name of the EA file from with-in the code somehow,

then from the file name "JOHNCORE 112.32231" we will need to remove the strings, which are "JOHNCORE" & ".",

in order to get our final result which would be only in numbers "11232231".


please can someone help me with that simple thing?, god bless if you can.

thanks i would be waiting for replies..

Mladen Rakic
71790
Mladen Rakic  
ArikKarish:

Hii guys it would be awesome if you can help me out here,


i need to get the EA file name and remove the strings from its name and have the final result in only numbers,

EXAMPLE:

EA name is "JOHNCORE 112.32231"

we need to get the name of the EA file from with-in the code somehow,

then from the file name "JOHNCORE 112.32231" we will need to remove the strings, which are "JOHNCORE" & ".",

in order to get our final result which would be only in numbers "11232231".


please can someone help me with that simple thing?, god bless if you can.

thanks i would be waiting for replies..

Use StringSplit() and Stringreplace() functions
ArikKarish
43
ArikKarish  
Mladen Rakic:
Use StringSplit() and Stringreplace() functions

but how about getting the file name? could someone just please help me to build this function please ?

whroeder1
17074
whroeder1  
ArikKarish:

we need to get the name of the EA file from with-in the code somehow,

then from the file name "JOHNCORE 112.32231" we will need to remove the strings, which are "JOHNCORE" & ".", in order to get our final result which would be only in numbers "11232231".

  1. Perhaps you should read the manual. The first is easy: WindowExpertName - Chart Operations - MQL4 Reference
  2. The second doesn't require StringSplit at all.
    Not compiled
    string numerics_only(string text){
       int iPos=0; 
       while(iPos < StringLen(text)){
          string c = StringSubstr(text, iPos, 1);
          if(c < "0" || c > "9") StringReplace(text, c, "");
          else ++iPos;
       }
       return text;
    }
    Not compiled

    Was that so hard you couldn't even attempt it?

  3. The real question is why would you want to do something different if someone renames the file?
Mladen Rakic
71790
Mladen Rakic  

whroeder1:

...

2. The second doesn't require StringSplit at all.

...

Whatever :) :) :)
ArikKarish
43
ArikKarish  

Thank you all guys for your time and help!, godbless,


i created the thing i wanted to create with the help of @whroeder1 thank you sir! you just saved me ton of manual work XD,

godbless and have a great week!

To add comments, please log in or register