String.Split - tutorial? samples?
-
Can someone please direct me to a tutorial and/or samples on the use of the String.Split method? (I seem to have problems translating C# help info for use with C++.) LudwigKeck
-
Can someone please direct me to a tutorial and/or samples on the use of the String.Split method? (I seem to have problems translating C# help info for use with C++.) LudwigKeck
String *limiter = S","; // --> The Limiter will be , Char delimiter[] = limiter->ToCharArray(); // --> Split-Method awaites a Char-Array String* parts[] = 0; // --> Receives all parts parts = line->Split(delimiter); if line is "one,two,three" so the parts are part[0] = "one" part[1] = "two" part[2] = "three" The answer is very late, but i'm a newbie @ Code-Project ( since yesterday ) Regards
-
String *limiter = S","; // --> The Limiter will be , Char delimiter[] = limiter->ToCharArray(); // --> Split-Method awaites a Char-Array String* parts[] = 0; // --> Receives all parts parts = line->Split(delimiter); if line is "one,two,three" so the parts are part[0] = "one" part[1] = "two" part[2] = "three" The answer is very late, but i'm a newbie @ Code-Project ( since yesterday ) Regards
Thank you Baerten, My problem was in C++, the code you show is C#. I have since worked it out the hard way (never did find any good documentation). In C++ the correct use is:
String^ data = "one,two,three"; array<>^ separator = {','}; array<>^ parts; parts = data->Split (separator);
As you can see, C++ syntax is just a bit opaque, (there should be just single arrow symbols where I show double). The module using this works fine for me now. However, now it causes a memory corruption in old legacy code that has worked for years. --- I'm not even sure how to describe it to forma help question. Such is life. Thank you again, and welcome to the world inside!!