Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub cmddollar_Click() 'This is the 1st button with the $
- Dim intpos As Integer
- Dim strword1 As String
- Dim intnum As Integer
- intpos = 1
- intnum = 1
- strword1 = strInput
- Do
- intpos = InStr(intnum, strInput, " ")
- intnum = intnum + 1
- If intpos <> 0 Then
- Mid(strword1, intpos, 1) = "$"
- End If
- Loop While (intpos <> 0)
- lblanwser.Caption = strword1
- Private Sub cmdDisplayNumber_Click() 'The 2nd button display how many words.
- Dim intpos As Integer
- Dim intCounter As Integer
- Do
- intpos = InStr(intpos + 1, strInput, " ")
- intCounter = intCounter + 1
- Loop While (intpos <> 0)
- lblanwser.Caption = intCounter
- Private Sub cmdoccurances_Click() 'The 5th one : how many occurences with the letter "a"
- Dim intNumA As Integer
- Dim intCounter As Integer
- Do
- intNumA = InStr(intNumA + 1, strInput, "a")
- If intNumA > 0 Then
- intCounter = intCounter + 1
- End If
- Loop While (intNumA > 0)
- lblanwser.Caption = intCounter & " time(s)"
- End Sub
- Private Sub cmdnm_Click() 'the 6th one: replace the letters "n and m" with "*"
- Dim intpos As Integer
- Dim intpos1 As Integer
- Dim intnum As Integer
- Dim strword2 As String
- Dim intnum1 As Integer
- intpos = 1
- intnum = 1
- strword2 = strInput
- Do
- intpos = InStr(intnum, strInput, "n")
- intnum = intnum + 1
- intpos1 = InStr(intnum, strInput, "m")
- intnum1 = intnum1 + 1
- If intpos <> 0 Then
- Mid(strword2, intpos, 1) = "*"
- End If
- If intpos1 <> 0 Then
- Mid(strword2, intpos1, 1) = "*"
- End If
- Loop While (intpos <> 0)
- lblanwser.Caption = strword2
- End Sub
Add Comment
Please, Sign In to add comment