Capitalize the first letter
Public Class Tester
Public Shared Sub Main
Dim quote As String = "AbCdEfG"
Dim result As New System.Text.StringBuilder
result.AppendLine("Original: " & quote)
result.AppendLine("Upper Case: " & quote.ToUpper())
result.AppendLine("Lower Case: " & quote.ToLower())
result.AppendLine("Mixed Case: " & MixedCase(quote))
Console.WriteLine(result.ToString())
End Sub
Public Shared Function MixedCase(ByVal origText As String) As String
Dim counter As Integer
Dim textParts() As String = Split(origText, " ")
For counter = 0 To textParts.Length - 1
If (textParts(counter).Length > 0) Then _
textParts(counter) = _
UCase(Microsoft.VisualBasic.Left( _
textParts(counter), 1)) & _
LCase(Mid(textParts(counter), 2))
Next counter
Return Join(textParts, " ")
End Function
End Class
Original: AbCdEfG
Upper Case: ABCDEFG
Lower Case: abcdefg
Mixed Case: Abcdefg
Change string to lower case and upper case
Public Class Tester
Public Shared Sub Main
Dim quote As String = "AbCdEfG"
Dim result As New System.Text.StringBuilder
result.AppendLine("Original: " & quote)
result.AppendLine("Upper Case: " & quote.ToUpper())
result.AppendLine("Lower Case: " & quote.ToLower())
result.AppendLine("Mixed Case: " & MixedCase(quote))
Console.WriteLine(result.ToString())
End Sub
Public Shared Function MixedCase(ByVal origText As String) As String
Dim counter As Integer
Dim textParts() As String = Split(origText, " ")
For counter = 0 To textParts.Length - 1
If (textParts(counter).Length > 0) Then _
textParts(counter) = _
UCase(Microsoft.VisualBasic.Left( _
textParts(counter), 1)) & _
LCase(Mid(textParts(counter), 2))
Next counter
Return Join(textParts, " ")
End Function
End Class
Original: AbCdEfG
Upper Case: ABCDEFG
Lower Case: abcdefg
Mixed Case: Abcdefg
Change string to upper case by using UCase
Class Tester
Shared Sub Main()
Dim userInput As String
userInput = " asdf "
Console.WriteLine(UCase(userInput))
End Sub
End Class
ASDF