[Scilab-users] Converting the result of strchr() to a boolean test?

scilab.20.browseruk at xoxy.net scilab.20.browseruk at xoxy.net
Sat Apr 2 15:19:14 CEST 2016


Hi,

I wan't to check a string for the presence of a particular character, which strchr() does perfectly:

-->strchr( 'fred', 'r' )
 ans  =
 red   
 
-->strchr( 'fred', 'b' )
 ans  =
 

But then I want to take some action based on the result, and my attempts to use strchr() as a boolean fail:

->if strchr( 'fred', 'r' ), then disp( 'found' ), else disp( 'not found' ), end;
                         !--error 44 
Wrong first argument.
 
Wrong first argument to what??

Thanks, Buk.

____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!






More information about the users mailing list