passing array of Char to Split method !!!

H

Herby

I originally had:

String^ line = gcnew String("abc, def; ghi" );

array<String^>^ mapEntries = line->Split(',');

I now want to extend this to include the semi-colon - something like

array<String^>^ mapEntries = line->Split( gcnew Char [] {',',';'});

i just cannot do it without getting a great list of errors:

..error C2552: '$S3' : non-aggregates cannot be initialized with
initializer list
'wchar_t *' is not an array or class : Types which are not
array or class types are not aggregate
error C2143: syntax error : missing ')' before '{'
error C2664: 'cli::array<Type>
^System::String::Split(cli::array<wchar_t,dimension> ^)' : cannot
convert parameter 1 from 'wchar_t *' to 'wchar_t'
with
[
Type=System::String ^,
dimension=1
]
There is no context in which this conversion is possible
error C2143: syntax error : missing ';' before '{'
error C2143: syntax error : missing ';' before '}'
error C2059: syntax error : ')'




What do i have to do?
 
J

James Park

Herby said:
I originally had:

String^ line = gcnew String("abc, def; ghi" );

array<String^>^ mapEntries = line->Split(',');

I now want to extend this to include the semi-colon - something like

array<String^>^ mapEntries = line->Split( gcnew Char [] {',',';'});
<snip>

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