[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Strip characters from number

Posted on 2004-04-14
3
Medium Priority
?
264 Views
Last Modified: 2010-04-15
Hi, I want the user to be able to enter any form of number in my price textbox and I will automatically strip anything that is not an integer.

I obviously can't mand a string.replace for every character, so is there a way to use a regexp to say anything that isnt 0-9?

This will match any unsigned integer:   ^\d*$     So is there a way to say   if(! ^\d*$)?

Thanks, Dave
0
Comment
Question by:KaiserSose
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 500 total points
ID: 10824191
you could just say .ToCharArray() and then use if char >= '0' && char <= '9' to determine if its numeric ...

or you could just use Char.IsNumber()
0
 
LVL 12

Assisted Solution

by:esteban_felipe
esteban_felipe earned 500 total points
ID: 10824543
Hi KaiserSose,

string result = Regex.Replace(input,"\\d",String.Empty)

Esteban Felipe
www.estebanf.com
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question