I tend to use StrConv(Fields!Field.Value, vbStrConv.ProperCase)
a lot in my reports, but am generally unhappy that it forces characters in the middle of words into lowercase too. I recently came across some camelCase strings where I wanted to split the words and preserve acronym capitalisation, while also capitalising the first letter of each word.
I came across this cool discussion of how to do part of this using RegEx on Stack Overflow and ended writing a little custom code snippet for these cases.
Public Shared Function NiceString(ByVal inputString As String) As String
' Return a blank string if necessary
If inputString Is Nothing Then
Return ""
Else
inputString = System.Text.RegularExpressions.Regex.Replace(inputString, "((?p{Ll}))", "$0")
Dim capitalise As Boolean = True
Dim returnString As New System.Text.StringBuilder(inputString.Length)
For Each c As Char In inputString
returnString.Append(IIf(capitalise, Char.ToUpper(c), c))
capitalise = Not Char.IsLetter(c)
Next c
Return returnString.ToString()
End If
End Function
It can be called like this:
=Code.NiceString(Fields!Field.Value)