all groups > c# > march 2005 >
You're in the

c#

group:

Extract words from a string


Re: Extract words from a string Mohammad
3/30/2005 3:25:52 PM
c#: Try this:

string s = "How are you?";

strnig[] tokens = s.Split( ' ' );

string var1 = tokens[0];
strnig var2 = tokens[1];
string var3 = tokens[2];
Re: Extract words from a string JV
3/30/2005 4:57:47 PM
take a look at the string.Split() method...should be straightforward.

[quoted text, click to view]

Extract words from a string Maya
3/30/2005 10:46:55 PM
Hello guys,

Is there an easy way to extract individual words that form a string and
store them in variables like in this example:

String "how are you?"

My result would be:

var1 = "how"
var2 = "are"
var3 = "you?"

Thanks alot,

Maya.

Re: Extract words from a string Maya
3/30/2005 11:59:36 PM
Yes split worked, cheers JV :)


[quoted text, click to view]

AddThis Social Bookmark Button