dcsimg
'if' condition created with a 'for loop'
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Nadene_Porter
Posted On:   Thursday, February 19, 2004 06:17 AM

I have a lengthy 'if' condition to enter (31 items)multiple times that can be constructed much easier using a 'for' loop. The only trouble is I can't figure out a way to use the resulting string in the if condition since it is expecting a boolean -- I keep getting an error message that says 'can't convert java.lang.String to boolean'.


Is there any type of wrapper or anything I can put around this string so I can use it in the 'if' condition?


Please help!!
thanks!!

Re: 'if' condition created with a 'for loop'

Posted By:   manu_kaushal  
Posted On:   Sunday, February 22, 2004 02:57 PM

What is the condition that you want to test. If you want to see if string exists why don't you use a != null. Otherwise, if you are checking the equality, then it returns boolean, else if it is some string comparison, you can put a boolean if the return value is positive or negative. Not sure what you want to do here. Please give the exact requirement.

Re: 'if' condition created with a 'for loop'

Posted By:   Anonymous  
Posted On:   Thursday, February 19, 2004 09:08 AM

Hi, if i can understand what you are trying to do, i would say that converting a string expression to a boolean may be related to the class Pattern from the regular expression API. If you can define a series of rules that can be match in your string, compiling them and then multiplying using matches would indeed use eventually a loop. But, that s all i can say about your problem.. if you could give more inputs.. :)
About | Sitemap | Contact