Part of my app has an area where users enter text into a textBox control. They will be entering both text AND numbers into the textBox. When the user pushes a button, the textBox outputs its text into a string, finds all numbers in the string, multiplies them by 1.14, and spits out the typed text into a pretty little textBlock.
Basically, what I want to do is find all the numbers in a string, multiply them by 1.14, and insert them back into the string.
At first, I thought this may be an easy question: just Bing the title and see what comes up.
But after two pages of now-purple links, I'm starting to think I can't solve this question with my own, very skimpy knowledge of Regex.
However, I did find a hearty collection of helpful links:
- This article from DotNetPerls
- This code snippet at Snipplr
- This question on MSDN
- This answer on StackOverflow
- This article from AssociatedContent
- This question on MSDN
- This article on Java2s.com
Please note: A few of these articles come close to doing what I want to do, by fetching the numbers from the strings, but none of them find all the numbers in the string.
Example: A user enters the following string into the textBox: "Chicken, ice cream, 567, cheese! Also, 140 and 1337."
The program would then spit out this into the textBlock: "Chicken, ice cream, 646.38, cheese! Also, 159.6 and 1524.18."
-.040
? Or1/3
? Or0x8f
? Or2^8
? Or1e7
? Those are all numbers.