|
-
July 1st, 2009, 10:46 AM
#1
is price a number - regexp problem
I have something like that:
Code:
Regex reg = new Regex(@"^\d+(\.\d\d)?$");
if (!reg.IsMatch(book.price))
{
}
But I have an error:
Error 4 Argument 1: cannot convert from 'decimal' to 'string'
What should I do ?
-
July 1st, 2009, 11:36 AM
#2
Re: is price a number - regexp problem
is book.price of type deciaml?
then I suggest you write
Code:
book.price.ToString()
Last edited by memeloo; July 1st, 2009 at 11:45 AM.
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback  you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
July 2nd, 2009, 02:47 AM
#3
Re: is price a number - regexp problem
If book.price is decimal such the error points, the price is number, there is nothing to check.
- Make it run.
- Make it right.
- Make it fast.
Don't hesitate to rate my post. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|