Results 1 to 4 of 4

Thread: convert string to number in asp.net

  1. #1
    Join Date
    Feb 2009
    Posts
    55

    convert string to number in asp.net

    I am a newbie in asp.net. I am working on some website for a project work. I have some query related to string in asp.net. I want to ask here that how can I convert the strings to numbers. Also I need some more different types of strings that I can apply. Like converting the numbers to string. But the first one is important. List me examples by which I can convert the strings to a numeric value.

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: convert string to number in asp.net

    See the below string example. It is used for converting strings to an numeric value. You can simply copy and paste the codes and see the result of the strings. I had tried them and they work fine. But the result also depends on the type of data which you are using. Try this.
    Code:
    <%
    ' CInt Converts to Integer
    ' CStr Converts to String
    ' TypeName Returns subtype variable for your control
    a = Cint(1)
    b = Cstr(1)
    Response.Write(TypeName(a)) & "<br>"
    Response.Write(TypeName(
    %>

  3. #3
    Join Date
    Oct 2005
    Posts
    2,393

    Re: convert string to number in asp.net

    I am listing you the strings which can convert the numbers to a string. Here you can use Str and CStr to convert a number and represent it like a string. The difference between both is that Str$ will add a space if the number is positive.

    v = 100

    Print Str$(v) ' Prints " 100"

    Print CStr(v) ' Prints "100"

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    Re: convert string to number in asp.net

    I am listing some string functions that will teach your how two apply the basic strings in asp by using the vbscript. This See the list below :
    • Asc(); - This gives you the ASCII character code.
    • cStr(); - This strings converts a number to a string.
    • LCase(); - Use to convert the string to lowercase. In same way-
    • UCase(); - Upper case,
    • Trim(); - This one is use to remove blank spaces.
    • Replace(); - Replace a character.

Similar Threads

  1. Convert string into int in C
    By screwball in forum Software Development
    Replies: 4
    Last Post: 22-12-2011, 08:47 PM
  2. Convert XML string into DOM
    By GreatThinker in forum Software Development
    Replies: 6
    Last Post: 22-07-2010, 09:48 AM
  3. Converting a string number into sequence of digits
    By KAIRU26 in forum Software Development
    Replies: 5
    Last Post: 13-03-2010, 04:46 PM
  4. How to Convert a String to GUID
    By shakira in forum Software Development
    Replies: 5
    Last Post: 07-07-2009, 11:42 AM
  5. How to convert string to int
    By Zavier in forum Software Development
    Replies: 3
    Last Post: 04-06-2009, 06:24 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,239,373.70576 seconds with 17 queries