Re: Converting string to double
- From: "tcomer" <tcomer@xxxxxxxxx>
- Date: 28 Nov 2006 07:15:18 -0800
SMichal wrote:
Hi, how can I parse string "? 20.000" to double ?
Well, you obviously need to remove the '?' character and space before
it can be parsed to any numerical format. So I would use the Split()
function to remove the '?' character and the Trim() function to remove
the space:
string strNumber = "? 20.000";
strNumber = strNumber.Split('?');
strNumber.Trim();
Then use the Convert.ToDouble() function to convert the string to a
double value:
double myVal = Convert.ToDouble(strNumber);
If the value you are converting should be represented as currency or
requires a certain degree of precision you should use the
String.Format() function after converting your value. I hope that helps.
.
- Follow-Ups:
- Re: Converting string to double
- From: garyusenet
- Re: Converting string to double
- References:
- Converting string to double
- From: SMichal
- Converting string to double
- Prev by Date: Re: Converting form "{X=12, Y=34}" to a Point
- Next by Date: Re: Problem with asp:hyperlink
- Previous by thread: Re: Converting string to double
- Next by thread: Re: Converting string to double
- Index(es):
Relevant Pages
|