I'm having issues with text that users enter into a Textbox
since not all users enter text in the correct manner. The users should be entering their text in the following format
xx xxxxxx xxxxxx x
Is there a way that I can take any text they enter (normally in the format of xxxxxxxxxxxxxxx
) and have it automatically add spaces?
I've looked into Regex
, InsertAt
, Replace
, and LastIndex
, but I'm not sure how to make it work. It's worth mentioning that the text is a string of numbers. Any help would be greatly appreciated.
I have tried to implement what is mentioned in the links below, but I guess I just don't understand Regex
enough to make it work.
Use Regex in C# to insert spaces between ConcatenatedFileNamesLikeThis?