< Public Function GetUnixName (Name As String) As String (?)
Comments'------------------------------------------------------------------------------ 'Create a title-cased name from the string given ' ' (e.g. " hello world__32" would become "HelloWorld32" ) '------------------------------------------------------------------------------
Public Function GetUnixName (Name As String) As String
Dim OutputName As String
Dim i As Integer
Dim Char As String
Dim StartOfWord As Boolean
'Deal with blank names
If Name = "" Then
GetUnixName = "Untitled"
Exit Function
End If
StartOfWord = True
'Look at all characters available
For i = 1 To Len(Name)
Char = Mid(Name, i, 1)
'If the character is something we can use, use it.
If Search("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz", Char) Then
OutputName = OutputName & IIf(StartOfWord, UCase(Char), LCase(Char))
StartOfWord = False
Else
'Otherwise ignore it, and mark that the next character will be uppercase
StartOfWord = True
End If
Next
'Deal with blank names (e.g. "--__ ")
If OutputName = "" Then
OutputName = "Untitled"
End If
GetUnixName = OutputName
End Function