Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 26-06-2009
Member
 
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.
Reply With Quote
  #2  
Old 26-06-2009
Member
 
Join Date: May 2008
Posts: 2,293
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(
%>
Reply With Quote
  #3  
Old 26-06-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
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"
Reply With Quote
  #4  
Old 26-06-2009
Member
 
Join Date: May 2008
Posts: 2,383
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 07:51 PM.