Shorthand String Split

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.
 
P

Peteroid

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==]
 
P

pigeonrandle

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

pigeonrandle

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

pigeonrandle

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.
 
P

pigeonrandle

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...
 
J

James Park

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>{ '.' });
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top