Write a function procedure named RemoveDollarSign that takes in a string parameter and returns a string value after removing the first character of the string if the first character is ‘$’. For example, if we call the procedure with the string parameter $20.56, the procedure should return 20.56
Imports System.IO
Module Module1
Sub Main()
Console.WriteLine(RemoveDollarSign("$20.56"))
Console.ReadLine()
End Sub
Function RemoveDollarSign(ByVal dollar As String)
For i As Integer = 0 To dollar.Length - 1
If dollar(i) = "$" Then
dollar = dollar.Remove(i, 1)
Return dollar
End If
Next
Return dollar
End Function
End Module
Comments
Leave a comment