www.webdeveloper.com
Results 1 to 5 of 5

Thread: How to convert from number to string

  1. #1
    Join Date
    Jun 2005
    Posts
    20

    How to convert from number to string

    hi,

    can anybody tell me how to convert from no to string.

    i want to read one variable as string

    is there any function like "cstr" in java script

  2. #2
    Join Date
    Feb 2005
    Location
    USA
    Posts
    1,534
    Code:
    var a=1;
    a=a.toString();
    or if you want to be lazy this will do the same thing:

    Code:
    var a=1;
    a=""+a;

  3. #3
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,119
    almost every thing is converted to string automatically or you can say that almost every thing is string in JS. however here is something you can do.

    var nStr = new String(2);
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

  4. #4
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Two other options, just use it as a string or use String (n)
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  5. #5
    Join Date
    Jun 2005
    Posts
    20
    Thanks Man,

    It working perfect for me.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles