Visual Basic provides the TrimStart and TrimEnd methods for removing one or more characters from the beginning
Question:
Visual Basic provides the TrimStart and TrimEnd methods for removing one or more characters from the beginning or end, respectively, of a string. The TrimStart method’s syntax is string.TrimStart[(trimChars)], and the TrimEnd method’s syntax is string.TrimEnd[(trimChars)]. The optional trimChars argument is a commaseparated list of characters that you want removed (trimmed). For example, if the txtSales control contains the string “$56.80”, you can remove the dollar sign from the control’s Text property using the statement txtSales.Text = txtSales. Text.TrimStart("$"c). The default value for the trimChars argument is the space character (" "c). When processing the TrimStart and TrimEnd methods, the computer makes a temporary copy of the string in memory; it then removes the characters from the copy only. Open the VB2015\Chap08\Tax Calculator Solution\Tax Calculator Solution (Tax Calculator Solution.sln) file. The btnCalc_Click procedure should calculate and display the sales tax using the amount entered in the text box and the rate selected in the list box. Be sure to remove any leading dollar signs from the sales amount. Also remove the trailing percent sign from the rate. Test the application appropriately.
Step by Step Answer: