6
Reply

How to select a character from a string? for example: string str = "Hello"; from the above string how to get the first letter into char c;

vinay kumar

vinay kumar

14y
9.9k
0
Reply

    string str = "Hello";
    char[] n;

     n = str.ToCharArray();
     Response.Write(n[0]);

    hello,Hirendra Sisodiya
    Char C=str.SubString(0,1).tostring()
    As you told this solution. can You please explain me wt does (0,1) means in above code?

    c = str.charAt(0)

    private char GetChar(string myString, char myChar)

    {

       return convert.toChar(myString.Substring(myString.IndexOf(myChar),myString.IndexOf(myChar)));

    }

    by calling this funtion you will get the expected character from string

    Hi Vinay,
    As you ask about the string related problem, just read this article, i hope this article help you. Click hear...

    Most programming languages are very rich in string operation..

    if we talk about VB.NET, we can use substring function like this

    Char C=str.SubString(0,1).tostring()

     

     

    thanks