Multi parameter return value 'return( "string",double) - page 2

 
Nelson Wanyama:

Thank you Lorentzos. I have picked up quite a bit from your code. 

I appreciate the effort and support.

You are welcome :) 

 
Nelson Wanyama:
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 is
   bool cleared_or_not_from_database = true;
////// at which date ?
   datetime date_taken_from_database = TimeCurrent();
// creation of the object to return
   return(new thing(cleared_or_not_from_database, date_taken_from_database));
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnStart()
  {
   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
 
Icham Aidibe:

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!!