Guest User

Untitled

a guest
Apr 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. Private Sub cmddollar_Click() 'This is the 1st button with the $
  2. Dim intpos As Integer
  3. Dim strword1 As String
  4. Dim intnum As Integer
  5.  
  6. intpos = 1
  7. intnum = 1
  8. strword1 = strInput
  9.  
  10. Do
  11. intpos = InStr(intnum, strInput, " ")
  12. intnum = intnum + 1
  13. If intpos <> 0 Then
  14. Mid(strword1, intpos, 1) = "$"
  15. End If
  16. Loop While (intpos <> 0)
  17.  
  18.  
  19. lblanwser.Caption = strword1
  20.  
  21.  
  22. Private Sub cmdDisplayNumber_Click() 'The 2nd button display how many words.
  23. Dim intpos As Integer
  24. Dim intCounter As Integer
  25.  
  26. Do
  27. intpos = InStr(intpos + 1, strInput, " ")
  28. intCounter = intCounter + 1
  29.  
  30. Loop While (intpos <> 0)
  31.  
  32. lblanwser.Caption = intCounter
  33.  
  34.  
  35.  
  36. Private Sub cmdoccurances_Click() 'The 5th one : how many occurences with the letter "a"
  37. Dim intNumA As Integer
  38. Dim intCounter As Integer
  39.  
  40. Do
  41. intNumA = InStr(intNumA + 1, strInput, "a")
  42. If intNumA > 0 Then
  43. intCounter = intCounter + 1
  44. End If
  45. Loop While (intNumA > 0)
  46.  
  47. lblanwser.Caption = intCounter & " time(s)"
  48. End Sub
  49.  
  50.  
  51.  
  52.  
  53. Private Sub cmdnm_Click() 'the 6th one: replace the letters "n and m" with "*"
  54. Dim intpos As Integer
  55. Dim intpos1 As Integer
  56. Dim intnum As Integer
  57. Dim strword2 As String
  58. Dim intnum1 As Integer
  59.  
  60. intpos = 1
  61. intnum = 1
  62. strword2 = strInput
  63.  
  64. Do
  65. intpos = InStr(intnum, strInput, "n")
  66. intnum = intnum + 1
  67. intpos1 = InStr(intnum, strInput, "m")
  68. intnum1 = intnum1 + 1
  69. If intpos <> 0 Then
  70. Mid(strword2, intpos, 1) = "*"
  71. End If
  72. If intpos1 <> 0 Then
  73. Mid(strword2, intpos1, 1) = "*"
  74. End If
  75. Loop While (intpos <> 0)
  76.  
  77.  
  78.  
  79. lblanwser.Caption = strword2
  80. End Sub
Add Comment
Please, Sign In to add comment