Hello I?m new with C#, so I have to figure out how to prevent entry of any punctuation marks or any other symbols from textbox to write it into the text document, allow only one white-space, characters and numbers. If punctuation mark is between two attached characters without white-space, then I want remove it and join this place, but if punctuation mark is somewhere between two characters with one or several white-spaces or if just several white-spaces I want remove mark(s) and keep only one white-space between words. And write everything in lower case.
So as I understand I need here following things, but have no idea how to do it:
1. Remove everything except character and numbers.
2. Keep only one white-space between attached characters and remove all extra white-spaces.
3. Join parts with characters if mark was between without white-space.
4. Write everything in lowercase.
5. And take into consideration that I used here `String.TrimEnd()` function to remove white-space at the end of each new line before write it into the file.
So for example if textbox content is:
Or with several white-spaces:
Or with several whitespaces with marks inside or marks attached to end or beginning of word:
Or marks between attached characters in word:
In result I want get in text document only:
So as I understand I need here following things, but have no idea how to do it:
1. Remove everything except character and numbers.
2. Keep only one white-space between attached characters and remove all extra white-spaces.
3. Join parts with characters if mark was between without white-space.
4. Write everything in lowercase.
5. And take into consideration that I used here `String.TrimEnd()` function to remove white-space at the end of each new line before write it into the file.
So for example if textbox content is:
C#:
Hello, off world 1!...
Or with several white-spaces:
C#:
hello off world? 1 --...
Or with several whitespaces with marks inside or marks attached to end or beginning of word:
C#:
*_Hello , off,%)- >world? 1
Or marks between attached characters in word:
C#:
H,e.*l+l-o .of!f wo/rld? 1
In result I want get in text document only:
C#:
hello off world 1