-
Notifications
You must be signed in to change notification settings - Fork 1
/
Q4s19qp22.vb
30 lines (27 loc) · 894 Bytes
/
Q4s19qp22.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Module Module1
Sub Main()
Dim InString As String = "12 34 5 39"
Dim NewString As String = ""
Dim NextChar As String = ""
Dim AfterSpace As Boolean = False
Dim Index As Integer = 0
Const Space = " "
'Loop for the erasing of spaces
For Index = 1 To Len(InString)
NextChar = Mid(InString, Index, 1)
If AfterSpace = True Then
If NextChar <> Space Then
NewString = NewString & NextChar
AfterSpace = False
End If
Else
NewString = NewString & NextChar
If NextChar = Space Then
AfterSpace = True
End If
End If
Next
Console.WriteLine(NewString)
Console.ReadKey()
End Sub
End Module