Click here to Skip to main content
15,895,142 members
Home / Discussions / C#
   

C#

 
GeneralRe: string to string array Pin
Stefan Troschuetz7-Jun-06 10:50
Stefan Troschuetz7-Jun-06 10:50 
GeneralRe: string to string array Pin
keroed_edmond7-Jun-06 11:05
keroed_edmond7-Jun-06 11:05 
GeneralRe: string to string array Pin
Stefan Troschuetz7-Jun-06 11:11
Stefan Troschuetz7-Jun-06 11:11 
GeneralRe: string to string array Pin
keroed_edmond7-Jun-06 11:50
keroed_edmond7-Jun-06 11:50 
GeneralRe: string to string array Pin
Ed.Poore7-Jun-06 10:51
Ed.Poore7-Jun-06 10:51 
GeneralRe: string to string array Pin
keroed_edmond7-Jun-06 11:09
keroed_edmond7-Jun-06 11:09 
GeneralRe: string to string array Pin
Ed.Poore7-Jun-06 11:26
Ed.Poore7-Jun-06 11:26 
AnswerRe: string to string array Pin
Guffa7-Jun-06 11:43
Guffa7-Jun-06 11:43 
You don't have to convert the string at all to access the separate characters. Just use an index to access the characters:

string message = "So long and thanks for all the fish.";<br />
char c1 = message[0]; // get the 'S' character<br />
char c2 = message[35]; // get the '.' character


You can easily convert a char to a string:

string s1 = new string(c1); // creates the "S" string<br />
string s2 = new string(c2); // creates the "." string


There are many ways to get a single character from a string into a new string. Here are some:

textbox.Text = new string(message[0]);<br />
textbox.Text = message.SubString(0, 1);<br />
textbox.Text = new string(message.ToCharArray()[0]);<br />
textbox.Text = new string(message.ToCharArray(), 0, 1);<br />
textbox.Text = new string(message.ToCharArray(0, 1));<br />
textbox.Text = new string((char)(new StringReader(message).Read()));



---
b { font-weight: normal; }

GeneralRe: string to string array Pin
Ed.Poore7-Jun-06 12:06
Ed.Poore7-Jun-06 12:06 
GeneralRe: string to string array Pin
Guffa7-Jun-06 12:38
Guffa7-Jun-06 12:38 
GeneralRe: string to string array Pin
Ed.Poore7-Jun-06 20:23
Ed.Poore7-Jun-06 20:23 
GeneralRe: string to string array Pin
vernchen7-Jun-06 23:05
vernchen7-Jun-06 23:05 
GeneralRe: string to string array Pin
Ed.Poore8-Jun-06 8:19
Ed.Poore8-Jun-06 8:19 
GeneralRe: string to string array Pin
Wjousts7-Jun-06 11:28
Wjousts7-Jun-06 11:28 
QuestionForce the Setup to RollBack()? [modified] Pin
Endren7-Jun-06 10:17
Endren7-Jun-06 10:17 
QuestionRSA Private Key Security Pin
Clonus7-Jun-06 10:00
Clonus7-Jun-06 10:00 
AnswerRe: RSA Private Key Security Pin
Ed.Poore7-Jun-06 10:37
Ed.Poore7-Jun-06 10:37 
GeneralRe: RSA Private Key Security Pin
Clonus8-Jun-06 2:59
Clonus8-Jun-06 2:59 
GeneralRe: RSA Private Key Security Pin
Clonus8-Jun-06 3:56
Clonus8-Jun-06 3:56 
GeneralRe: RSA Private Key Security Pin
Ed.Poore8-Jun-06 8:11
Ed.Poore8-Jun-06 8:11 
QuestionGetMembers and COM Pin
dcadenas7-Jun-06 9:00
dcadenas7-Jun-06 9:00 
QuestionUpdate progress bar from a separate project Pin
snorkie7-Jun-06 8:34
professionalsnorkie7-Jun-06 8:34 
AnswerRe: Update progress bar from a separate project Pin
Stefan Troschuetz7-Jun-06 10:01
Stefan Troschuetz7-Jun-06 10:01 
QuestionAborting / Killing Threads Pin
MrEyes7-Jun-06 8:08
MrEyes7-Jun-06 8:08 
AnswerRe: Aborting / Killing Threads Pin
Ed.Poore7-Jun-06 10:45
Ed.Poore7-Jun-06 10:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.