Exercise
Strings manipulation
Objetive
Create a Visual Basic (VB.Net) program that asks the user for a string and:
- Replace all lowercase A by uppercase A, except if they are preceded with a space
- Display the initials (first letter and those after a space)
- Display odd letters uppercase and even letter lowercase
The program must display all generated strings.
Code
Imports System
Class exercise89
Private Shared Sub Main(ByVal args As String())
Console.Write("Tell a string: ")
Dim Entry As String = Console.ReadLine()
Dim result As String
result = Entry.Replace("a", "A")
Console.WriteLine(result)
Console.WriteLine(UppercaseFirst(Entry))
End Sub
Public Shared Function UppercaseFirst(ByVal s As String) As String
Return Char.ToUpper(s(0)) & s.Substring(1)
End Function
End Class