I want to add some spaces in “BozzoTheClown” kind of string to get:
“Bozzo The Clown”.
Ideas (instead of loop into the string and add a space if the letter is from uppercase A…Z) ?
I want to add some spaces in “BozzoTheClown” kind of string to get:
“Bozzo The Clown”.
Ideas (instead of loop into the string and add a space if the letter is from uppercase A…Z) ?
Thank you Stephan, seems a good solution… and a nice screen shot !
Public Function ExplodeCamels(words As String) As String
Var re As New RegEx
re.SearchPattern = "(([a-z])([A-Z]))"
re.ReplacementPattern = "$2 $3"
re.Options.CaseSensitive = True
re.Options.ReplaceAllMatches = True
Return re.Replace(words)
End Function
Thank you Rick:
I have a visit of a friend and so I do not explored RegEx before I read your addition (code).
Now I only have to copy / paste it in my project !
Public Function ExplodeCamels(words As String) As String
Var re As New RegEx
re.SearchPattern = "([a-z])([A-Z])"
re.ReplacementPattern = "$1 $2"
re.Options.CaseSensitive = True
re.Options.ReplaceAllMatches = True
Return re.Replace(words)
End Function
^^^ After a tiny clean up (removed residuals from my first test)