Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

strings,# occurrences

Status
Not open for further replies.

bryman

Programmer
Oct 3, 2001
9
0
0
US
I need help searching strings,# vowels,consonants,sentences,spaces
any examples?
 
Hello

The following should give you some idea
Add a text box (text1.text) and set the caption to

"The cat sat on the MAT"

then add the following code behind a command button, when you run your project you should see a list, printed to the form, of the different characters found within the string.

Kate

Private Sub Command1_Click()

Dim c As Integer
Dim temp As String * 1

For c = 1 To Len(Text1.Text)
temp = Mid$(Text1.Text, c, 1)
Select Case temp

Case "a", "e", "i", "o", "u", "A", "E", "I", "O", "U"
'found a vowel
Print "Vowel at position " & c
Case "a" To "z"
'found a lowercase letter
Print "LowerCase letter at position " & c
Case "A" To "Z"
'found an uppercase letter
Print "UpperCase letter at position " & c
Case Space(1)
'found a space
Print "space found at position " & c
Case Else
'found something else
End Select

Next c
end sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top