Shorthand String Split

  • Thread starter Thread starter pigeonrandle
  • Start date Start date
P

pigeonrandle

Hi. It's late, my eyes and brain are both seizing up and i'm quite
surprised my fingers are still working!

Can anyone tell my what i am doing wrong here?

System::String* sTest = S"this.is.really.annoying.me";
System::String* sTemp[] = sTest->Split(System::Char[] {'.'});

I know i can use:

System::Char cDelim[] = {'.'};
System::String* sTest = S"this.is.really.annoying.me";
System::String* sTemp[] = sTest->Split(cDelim);

but for the love of good, there must be a way i can squeeze it into two
lines. Vertical space is at a premium!

James.
 
Well, if vertical spacing is your only concern, did you know you can put
multiple lines on the same vertical line, ala:

int x = 0 ; int y = 1 ; if (x == y) { --x ; } ; // etc.

[==P==]
 
Please?! It's always the little things that are irritating. At least
that's what my girlfriend keeps telling me. I have no idea what she
means but...
 
P,
Cheers for your response, but i already knew that! I just want to know
how to cast to a char array when passing a parameter.

Cheers,
James.
 
P,
Yes i already knew that thanks! I just wanted to know how to cast to a
char array and pass it as a parameter...

Cheers,
James.
 
Please?! It's always the little things that are irritating. At least
that's what my girlfriend keeps telling me. I have no idea what she
menas but...
 
IIRC, there isn't a way using MC++. You can do what you're looking for with
C++/CLI though.

array<String^>^ sTemp = sTest->Split(gcnew array<Char>{ '.' });
 
Back
Top