How to separate a string into char array

  • Thread starter Thread starter ad
  • Start date Start date
A

ad

I have a string vaiable like "1a3345";

How to separate the string into a char array or a string array just have on
character per element?
 
ad said:
I have a string vaiable like "1a3345";

How to separate the string into a char array or a string array just have on
character per element?


string s = "1a3345";
char[] c = s.ToCharArray();

Hope it helps,
Andrey
 
ad said:
I have a string vaiable like "1a3345";

How to separate the string into a char array or a string array just have
on
character per element?

string by itself can be accessed as an array of chars
*********************************
string s = "1a3345";
char c = s[1];
Console.WriteLine(c);
*********************************
will give you "a" as an output

RGDS PSG
 

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

Back
Top