but I can't split this string using "\t" with which I glue the items together?
I understand what you are saying. You would like string split to have been implemented as StringSplit(string,string,string &[]) rather than a single char for splitting. There may be some merit in that point of view. (more versatile and yet 'simpler' for non-coders), But MQL have not implemented it that way.
If you really want to make you own StringSplit(string,string,string &[]) that makes you happy, you could probably combine StringReplace and StringSplit but it will need to be careful!
Now we have StringReplace and StringSplit it would be much simpler, and faster to use
// not real code - error handling and selection of USHORT separator ommitted to etc.
int MyStringSplit(stringin,string sep,string &out[]) {
StringReplace(in,sep, string form of SOME_USHORT_NOT_IN_STRING);
return StringSplit(in, SOME_USHORT_NOT_IN_STRING,out);
}
I wrote,"oryou can build your own function"It'sup to him
personallyi prefer not tochange the source string,andleave itas is (by using StringReplaceyou are changing the source),just to use a copy (string& Out[])
I didnt quite get the 'or' because I was also suggesting the same thing -
[me]If you really want to make you own StringSplit ...
[you]or build your own function'
[me]huh??
It would have made more sense to me if your post read 'or you can do it like this'.
qjol: personallyi prefer not tochange the source string,andleave itas is
It would not change the source because 'in' is is pass by value in
int MyStringSplit(stringin,string sep,string &out[])
For clarity you could simply assign 'in' to another string 'inCopy'.
I'd rather a two line function calling built- in functions than the alternative implementation which will be slower and potentially makes many calls to ArrayResize (although there are ways around that, esp with the new ArrayResize), but like you say, personal preference :)
Also I've ommited the check to ensure that USHORT is not already in the original string. So maybe it will end up about 6 lines
Also the last parameter in StringSubstr is changed in MQL4++ so the linked function will need modifying. But that's quite simple once one is aware of it.
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.
Well to me it's still funny.
I join a string by:
but I can't split this string using "\t" with which I glue the items together?
I understand what you are saying. You would like string split to have been implemented as StringSplit(string,string,string &[]) rather than a single char for splitting. There may be some merit in that point of view. (more versatile and yet 'simpler' for non-coders), But MQL have not implemented it that way.
If you really want to make you own StringSplit(string,string,string &[]) that makes you happy, you could probably combine StringReplace and StringSplit but it will need to be careful!
or you can build your own function
https://www.mql5.com/en/forum/116685
or you can build your own function
https://www.mql5.com/en/forum/116685
Now we have StringReplace and StringSplit it would be much simpler, and faster to use
I wrote, "or you can build your own function" It's up to him
personally i prefer not to change the source string, and leave it as is (by using StringReplace you are changing the source), just to use a copy (string& Out[])
but again, each one with is personal preference
qjol I wrote, "or you can build your own function"
I didnt quite get the 'or' because I was also suggesting the same thing -
It would have made more sense to me if your post read 'or you can do it like this'.
qjol: personally i prefer not to change the source string, and leave it as is
It would not change the source because 'in' is is pass by value in
For clarity you could simply assign 'in' to another string 'inCopy'.
I'd rather a two line function calling built- in functions than the alternative implementation which will be slower and potentially makes many calls to ArrayResize (although there are ways around that, esp with the new ArrayResize), but like you say, personal preference :)
Also I've ommited the check to ensure that USHORT is not already in the original string. So maybe it will end up about 6 lines
https://www.mql5.com/en/forum/116685
Also the last parameter in StringSubstr is changed in MQL4++ so the linked function will need modifying. But that's quite simple once one is aware of it.
I think . . .
"\t" is a string
'\t' is a character ASCII 9
. . . I could be wrong though.