Computer Science Canada help with strings and removing stuff |
Author: | r0ssar00 [ Tue Sep 20, 2005 1:49 pm ] | ||||
Post subject: | help with strings and removing stuff | ||||
i built a lib for finding the biggest word in a string with three words or less when i use the lib from within it, like a proc, it works fine, but when i import it into a test prog that i wrote up, it returns the shortest word it only manifests itself when the data passed to it is in the form of a variable. when the data passed to it is just a string not in a var, as in on the same line, in brackets, it works fine. could i get some help with this? its just a general lib that can b used for anything, its not very specific except for what it does. the main object is returnBiggest and it's a function heres the prog
and my test proggy, asks for three words or less, then prints out the result of variable returned
i really need this 2 work, the problem is probly somethin stupid, but i cant find it, plz help |
Author: | beard0 [ Tue Sep 20, 2005 4:03 pm ] | ||
Post subject: | Re: help with strings and removing stuff | ||
you're really gonna kick youself: r0ssar00 wrote:
See it? No? :* might help get multiple words |
Author: | r0ssar00 [ Wed Sep 21, 2005 7:07 am ] |
Post subject: | |
i kicked myslef a million times, i was right, it was somethin stupid, and it works completly now, thanks a lot. sometimes its the stupid things u miss when looking at the big picture on how it works |
Author: | wtd [ Wed Sep 21, 2005 11:48 am ] | ||||
Post subject: | |||||
A "good practices" note:
What does "returned" mean? Sure, it's the value returned form the returnBiggest function, but there are lots of functions. A more meaningful name would be:
|
Author: | r0ssar00 [ Wed Sep 21, 2005 1:56 pm ] |
Post subject: | |
i had only made a test program for example, conventions can go to hell in it for all i care, in my other program that uses it, i have meaningful var names. sorry, i should have done it, but it was a quicky prog. |
Author: | wtd [ Wed Sep 21, 2005 2:15 pm ] |
Post subject: | |
I understand, but you should get into the habit. Otherwise bad habits creep into all of your code. |