1

So, I made a program that for the most part, converts numbers to letters. My problem before was it was converting each individual digit instead of each number e.g. (1-0-1 instead of 101). Someone suggested that I use the Split function:

    Dim numbers As String() = DTB.Split(" ")

So now it's reading the number all the way through being that it will only the split if there's a space in between. My problem now is that it's translating for example: "[102, 103, 104]" as "[102", "103" and "104]" because it will only split if there's a space between. Obviously, you can't convert "[102" or "104]" because they aren't actual numbers.

Does anyone have a solution on what I should do to get this to convert no matter the spacing? Would Regex be the way to go?

Bit Deception
  • 297
  • 1
  • 3
  • 7

1 Answers1

1

use a regular expression with \d+ it will match numbers

so

12234abcsdf23434

will return two matches

12234
23434
Keith Nicholas
  • 43,549
  • 15
  • 93
  • 156
  • Thank you. Works great. I should probably learn Regex as I most likely wouldn't have had this question. Looks somewhat daunting which is why I've been avoiding it. – Bit Deception Apr 22 '13 at 00:26
  • They are really useful, I also use this free tool http://www.ultrapico.com/Expresso.htm and then tried solving some peoples problems on stackoverflow with regex queries, quite a good way to learn. – Keith Nicholas Apr 22 '13 at 00:36
  • Ok. Sorry. I've never really used this site before. I don't believe I can up vote yet though (my rep). – Bit Deception Apr 22 '13 at 02:37