Dim sTotal1 As String Dim sTotal2 As String Dim Prompt As String = "Enter Value" Dim lTextLength As Long Dim sChar As String Dim bASCII As Byte Dim x As Long sTotal1 = "The quick red fox jumped over the lazy brown dog" lTextLength = Len(sTotal1) 'Gets # of chars in sTotal1 lTextLength = InputBox(Prompt, "display total of ASCII values") For x = 1 To lTextLength 'Loop through string one char at a time sChar = Mid$(sTotal1, x, 1) 'Gets the x'th charcter in sTotal1 bASCII = Asc(sChar) 'Gets ASCII value of character MsgBox("The ASCII value of '" & sChar & "' is " & bASCII) 'Display results Next x End Sub
Write a program that will display the total of all the ASCII values(integer values) of each letter in a string (not including spaces). For your reference the ASCII value of 'A' is 65. You must use a loop in the calculation and you must use a VB procedure within VB.NET to return the ASCII code for an individual letter.
The program should produce two totals, the first using the following sentence as a fixed string:-
"The quick red fox jumped over the lazy brown dog"
The total should then be displayed.
Then, using an empty string of 80 characters maximum length, input any sentence using both alphanumeric and numeric characters.
"Snow white and the 7 dwarves waited for Prince Charming:- he was late!"
The program should then calculate and display the total in a similar way as for the first example.
HOW DO I REMOVE THE SPACES
HOW DO I DISPLAY THE TOTAL