Hi there, i would like to know how to get the first letter of all the word in a string.

If i have a string

mystring="Name Surname"

i would like to get only the fist letter of each words and the results will be

N S

Anybody could help with that?

thanks

mystring=Split("Name Surname")
for each x in mystring


    response.write(left(x,1) & "<br />")


next

//Dude I have written the following code in console application.It worked correctly.I am assuming you know how to //take user input and store it in the string variable.Also, that you now how to write to output.you need to focus at //the for loop.

        string mystring = "";
        Console.WriteLine("Please enter a name");
        name = Console.ReadLine();

        for (int i = 0; i < name.Length; i++)
        {
            //bool b = false;
            if (i == 0)
            {
                Console.Write("{0} ",name[i]);
            }
            while(name[i] ==' '  )
            {
                i++;
                if (name[i] != ' ')
                {
                    Console.Write("{0} ", name[i]);
                }
            }
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.