vinay kumar
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;
By vinay kumar in OOP/OOD on Jun 23 2010
  • JASPAL
    Apr, 2012 3

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

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

    • 0
  • kanchan setia
    Feb, 2011 3

    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?

    • 0
  • Phuc Nguyen
    Dec, 2010 20

    c = str.charAt(0)

    • 0
  • Uday Gaikwad
    Aug, 2010 25

    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

    • 0
  • Manish Tewatia
    Aug, 2010 12

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

    • 0
  • Hirendra Sisodiya
    Jun, 2010 24

    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 

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS