It seems so simple, yet it is making me “want” to kill myself after two days of constant battle with it.
I have a TextField, a Module, and a Button
The Module have a string array property with these settings (tell me if it’s the wrong way to define a property as an array):
name = Words()
Type = string
scope = protected
The user is supposed to enter many words inside the TextField, and upon clicking the button, the words are supposed to get stored into myModule.Words
The user is instructed to enter the words as a long single string, and separate the words with “,” without any spaces, like:
word1,word2,word3
But some users might not be careful and enter some spaces here and there, like:
word1, word2 , word3 ,word4 , word5
This is my code for doing it, but it is not working at all:
[code] dim Trimmed() as string
dim shreddedString() as string
dim singleCode as string
// shredding the long string into single characters
shreddedString = Split(TextField.text, “”)
// filtering whitespace and “,” characters
for each char as string in shreddedString
if char <> " " and char <> “,” then
singleCode = singleCode + char
// end of the current word, time to save it
else
if singleCode <> "" then // to avoid saving "" (empty) words, if TextField.Text had ",word1" or ",," , etc
Trimmed.Append(singleCode)
end if
end if
next
myModule.Words = Trimmed[/code]