hi.. i would like to save every word in the sentence separating by space " "...
any idea on it??
thxx
hi.. i would like to save every word in the sentence separating by space " "...
any idea on it??
thxx
Get lenght of sentence by len(string), use for i = 1 to lenght of sentence with mid(sentence i 1) to get characters and combine words after characters isn't space or punctuation.
hi.. i would like to save every word in the sentence separating by space " "...
any idea on it??thxx
this is one way
'set up an array to contain the words
Dim words(1 To 100) As String
'get the length of the sentence
sentencelength = Len(sentence)
'set a counter for the number of words
flag = 1
'a do loop to find the words
Do Until sentencelength = 0
'find the first space in the sentence
firstspace = InStr(sentence, " ")
'record the first word
words(flag) = Left(sentence, firstspace - 1)
'increment the word counter
flag = flag + 1
' knock the first word (and space) off sentence
sentence = Mid(sentence, firstspace + 1)
'get the new sentence length
sentencelength = Len(sentence)
Loop
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.