Click to See Complete Forum and Search --> : can u check this code please? i can't get it to work!


adamm104
March 1st, 2006, 02:17 PM
i can't figure this code out, supposed to type in a name like George Washington, and have it appear in a label, Washington, George

it has to have the comma and a space between comma and first name, thanks!

gigemboy
March 1st, 2006, 03:02 PM
Just a simple exercise in string manipulation....

One way is to just split the string on the Space character, into an array of strings. Then for the output, concatenate the 1 index of the array (lastname) with a comma and a space, then the 0 index of the array (first name)....

Another way is to just use .IndexOf on the space character, to get the position, then use that and .SubString in order to get the two parts of the string, then switch them seperated with a command and a space when you build the output string....

HanneSThEGreaT
March 2nd, 2006, 07:09 AM
Here's a list of all String Manipulation functions, they will come in very handy someday!
http://msdn2.microsoft.com/en-us/library/e3s99sd8.aspx

PS: Please edit your thread title to something more descriptive :thumb: