Extract all punctuation marks from string in VB.net
3 answers
If you want a non-regex you can try something like this:
Dim stringname As String = "^^^%%This,,,... is $$my** original(((( stri____ng."
Dim sb As New StringBuilder
Dim c As Char
For Each c In stringname
If Not (Char.IsSymbol(c) OrElse Char.IsPunctuation(c)) Then
sb.Append(c)
End If
Next
Console.WriteLine(sb.ToString)
Exit " This is my original string
".
0
source to share