CamelCase in Basic
Example for versions
vbnc 2.4.2
This program checks each letter of the string for being a letter; if it is not, it is replaced with a space. After this the string is converted to proper case (all words are lower case, starting with capital letter), and finally all spaces are removed.
Module Module1
Sub Main()
Dim Text As String
Dim i As Long
Try
Text = LCase(Console.ReadLine())
Catch ex As Exception
Console.WriteLine("Invalid input.")
Return
End Try
For i = 1 To Len(Text) Step 1
If InStr("abcdefghijklmnopqrstuvwxyz", GetChar(Text, i)) = 0 Then
Text = Replace(Text, GetChar(Text, i), " ")
End If
Next
Console.WriteLine(Replace(StrConv(Text, vbProperCase), " ", ""))
End Sub
End Module
Comments
]]>blog comments powered by Disqus
]]>