Hello guys. I created a string parser that uses a delimiter to extract multiple parameters from a string variable, or a string return value
of a function.
The results have to be typecasted to the corresponding types as they are stored in string array. Is there a better way to do this?
example:
Is there a different approach I can try, or is using my string parser enough?
If you need the parser, just ask.
Hey Nelson ! Wasn't it you looking for OOP few days ago ? Sometimes it's perfectly useless and a timeloss but some other times ... it makes a
sense
class thing
{
public:
bool cleared;
datetime date;
thing() {};
~thing() {};
thing(bool clrd, datetime dt) { cleared = clrd; date = dt; }
};
///
thing *ishecleared(string name)
{
// all the test to find out more about 'name'printf("Hello I'm looking %s in my database", name);
////// is the thing cleared ? let's suppose it isbool cleared_or_not_from_database = true;
////// at which date ?datetime date_taken_from_database = TimeCurrent();
// creation of the object to returnreturn(new thing(cleared_or_not_from_database, date_taken_from_database));
}
//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+voidOnStart()
{
string name = "John";
thing *anotherthing = ishecleared(name);
printf("cleared (0/1) : %g / date : %s",anotherthing.cleared,TimeToString(anotherthing.date,TIME_DATE|TIME_MINUTES|TIME_SECONDS));
delete anotherthing;
}
//+------------------------------------------------------------------+
test (USDCHF,H1) Hello I'm looking John in my database
test (USDCHF,H1) cleared (0/1) : 1 / date : 2020.05.29 23:54:59
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Thank you Lorentzos. I have picked up quite a bit from your code.
I appreciate the effort and support.
You are welcome :)
Is there a different approach I can try, or is using my string parser enough?
If you need the parser, just ask.
Hey Nelson ! Wasn't it you looking for OOP few days ago ? Sometimes it's perfectly useless and a timeloss but some other times ... it makes a sense
Hey Nelson ! Wasn't it you looking for OOP few days ago ? Sometimes it's perfectly useless and a timeloss but some other times ... it makes a sense
This is the creativity I was looking for. Thanks!!