Answer to Question #271731 in Visual Basic for Maika Togavuto

Question #271731

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


1
Expert's answer
2021-11-26T07:07:54-0500
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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS