String question....

Fusion92
09-07-2003, 04:26 PM
Ok, the program I have to make probably seems so simple...but for the life of me I can't figure it out...

- I enter a phrase into a string variable called "phrase"
- Let's say the phrase is "Hello There"
- When I press the command button, the program has to search the string for vowels (a, e, i, o, u, y) and replace them with asteriks (*)...
- So my phrase would be "H*ll* Th*r*" after the command button is pressed....

I can't solve this cause I'm a little rusty after being off school for the summer :(

Any help would be appreciated...
Thanks in advance :)

Fusion92
09-07-2003, 05:38 PM
I got it now.........

just in case others need it...


Option Explicit
Dim phrase As String
Dim phrase2 As String
Dim i As Integer

Private Sub cmdGo_Click()

For i = 1 To Len(phrase)
Select Case LCase(Mid(phrase, i, 1))
Case "a", "e", "i", "o", "u", "y"
Mid(phrase, i, 1) = "*"
End Select
Next i

lblDis2.Caption = phrase
End Sub

Private Sub Form_Load()
phrase = InputBox("Please enter a phrase.", "Phrase")
lblDis1.Caption = phrase
End Sub

loGin
09-07-2003, 05:44 PM
thats way to much work lol
just use the replace() function...
string$ = replace(string$, "a", "*")

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum