Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim YourString As String = TextBox1.Text '
- ' strip out the spaces
- YourString = System.Text.RegularExpressions.Regex.Replace(YourString, " ", "")
- While YourString.Length() > 0 ' loop round untill we run out of characters
- Dim pattern As String = "\" + YourString.Substring(0, 1) ' take the first character of YourString
- Dim ex As New System.Text.RegularExpressions.Regex(pattern)
- Dim m As System.Text.RegularExpressions.MatchCollection
- m = ex.Matches(YourString) ' get the number of matches
- Message = Message + String.Format("{0}*{1}'s ", m.Count.ToString(), YourString.Substring(0, 1)) ' format the message
- YourString = System.Text.RegularExpressions.Regex.Replace(YourString, pattern, "") ' remove the character
- End While
- TextBox2.Text = Message
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement