jfb
New Member
Posts: 32
|
Post by jfb on Mar 10, 2007 21:50:28 GMT -5
Is there some sort of an equivalent for the following JB command in TW?
print #handle.ext, "selectindex "; i
Also, is there a way to directly compare two (2) strings for content? -- something Like:
if selected$ = array$(i) then
Thanks, JFB
|
|
|
Post by Alyce Watson on Mar 11, 2007 7:16:09 GMT -5
Is there some sort of an equivalent for the following JB command in TW? print #handle.ext, "selectindex "; i No. All commands recognized by controls are in the help topic "Controls" so you can always check there if you are unsure. Sure. StringCompare, documented in the Strings topic. I'll paste it here for you.
|
|
jfb
New Member
Posts: 32
|
Post by jfb on Mar 11, 2007 19:42:26 GMT -5
Thanks for the reply. Don't worry, I am reading the heck out of the help topics. So my questions do not arise simply because I'm too lazy to read. When I read about the stringcompare command, however, the help topic talked about comparing strings to see if one is larger or smaller or equal in length. Perhaps I didn't understand what that (length) means in this context. But what I want is something will tell me weather the content of sting A is exactly like the content of string B. I will test for this, so I'm not necessarily waiting for a reply...
I am adapting a JB program over to TW, so far things are going pretty good. When I'm finished, would it be acceptable to post the code on this forum?..
Thanks again, JFB
|
|
|
Post by Alyce Watson on Mar 12, 2007 5:42:37 GMT -5
It would be great if you post it!
The helpfile could be improved, since it is not clear. The stringcompare does not compare length, nor does it say that it compares length. It compares characters to see if they are equivalent, smaller or larger. The helpfile says, "'A' is less than 'B' and so on." I can see how that is confusing. It is a comparison of characters according to their ascii values.
Try running stringcompare.thw that comes with Thistle-Win. It reports that "Hello" is less than "World!"
Now change all occurances of "World!" to "aaaaa". The "aaaaa" string is the same length as "Hello" but it will give you the message that "Hello" is greater than "aaaaa". That's because it compares the "H" with the "a" and sees that H is greater.
Now compare "Hello" to "Hella". They are exactly the same, except for the final letter. It will report that Hello is greater than Hella. That's because it keeps comparing characters until it finds an inequality.
Change all occurances of the word "World!" to "Hello" to exactly match the first string. You'll see that it compares as equal.
There appears to be an error in the helpfile. The comparison is case-sensitive, not case insensitive.
If you only want to compare lengths of strings, use the len() function.
|
|
jfb
New Member
Posts: 32
|
Post by jfb on Mar 12, 2007 10:09:09 GMT -5
Thanks,
stringcompare, then, is exactly what I need...
I have one more Listbox related question: is there a way to remove/delete an item from the list; or re-load the list; or close the list and re-open a new list? As you can quess, I'm looking for some way to edit a Listbox...
JFB
|
|
|
Post by Alyce Watson on Mar 14, 2007 5:48:00 GMT -5
There is no way to delete an item from a listbox. Sorry.
|
|