View Full Version : Split words
09-26-2007, 07:03 PM
In general when we split words we use:
xwords= split(ywords," ")
But, using a table, for example, tableA, where there is a column named "names" where the strings are single words. As I split each word in this way:
Thanks in advance,
09-26-2007, 08:02 PM
Were you meaning to ask a question?
09-26-2007, 10:13 PM
I think his question is, how do you split a word based on certain number of letters.
Silly question -- WHY would you ever want to do this?
But, I digress - You would need to use many different functions to accomplish this task:
3) FOR NEXT loop
This works, although that is based on whether or not I am correctly interpreting your question:
<% function splitLetters(strWord)
letterCount = len(strWord)
for x=1 to letterCount-1
if Eval(x/2) = Eval(2/x) then
strWord2 = strWord2 & mid(mid(strWord,x,2),x-1,3) & ","
strWord2 = strWord2 & mid(strWord,x,2) & ","
splitLetters = left(strWord2,len(strWord2)-1)
end function %>
<p>Night: <%= splitLetters("night") %></p>
<p>Achieve: <%= splitLetters("achieve") %></p>
<p>Astronomy: <%= splitLetters("Astronomy") %></p>
<p>Coding: <%= splitLetters("Coding") %></p>
<p>Forums: <%= splitLetters("Forums") %></p>
<p>luigicannavaro <%= splitLetters("luigicannavaro") %></p>
<p>miranda: <%= splitLetters("miranda") %></p>
<p>Daemonspyre: <%= splitLetters("Daemonspyre") %></p>
Things you have to watch out for: SPACES, Case SeNsItIvItY, NULL values, Empty strings.
09-27-2007, 02:18 PM
Thanks a lot!
Yes, it is possible do a lot of things using these functions.
The script works fine and works like I want.
10-08-2007, 12:25 AM
So how about thanking him for this helpfull post?
I'm sure he'd like that ;)
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.