Download MetaTrader 5
To add comments, please log in or register
Develop trading robots to order. Make profit with Freelance service!
user_123
172
user_123 2014.11.14 10:10 

Hello,

does somebody know, if is there a possibility to use a two-dimensional array in the StringSplit function. If I use it like bellow, than I get always an error: ']' - expression expected, 'TradeValues' - array required

I want to write the split strings in the second dimension of the array TradeValues[][]


string sep=";";                // A separator as a character
ushort u_sep;                  // The code of the separator character
u_sep=StringGetCharacter(sep,0);

string  LineValues[100];   
string TradeValues[100][8];
   
for(int k=0;k<100;k++){
   StringSplit(LineValues[k],u_sep,TradeValues[100][]);      
}

or

string sep=";";                // A separator as a character
ushort u_sep;                  // The code of the separator character
u_sep=StringGetCharacter(sep,0);

string  LineValues[100];
string TradeValues[100][8];   
for(int k=0;k<100;k++){
      StringSplit(LineValues[k],u_sep,TradeValues[100]);      
}

Thank you very much!


Carl Schreiber
5927
Carl Schreiber 2014.11.14 10:27  

No you can't if you would have looked into your reference under StringSplit you would have seen the definition:

int  StringSplit(
   const string   string_value,       // A string to search in
   const ushort   separator,          // A separator using which substrings will be searched
   string         & result[]          // An array passed by reference to get the found substrings
   );

and StringSplit(..) expects only a one dimensional string array result[].

Then you can copy element by element..



/
To add comments, please log in or register