Howdy Tim:

       I'm a big fan of ANY and ALL for instance like that

char-pos: func [str [string!] ch [char!] /r][
    any [all [r: find/case str ch index? r] 0]
]

> Hi:
>      I have written a function to find the matching index
> for a character in a string:
> 
> ;code follows:
> char-pos: func [str[string!] ch[char!] /local result] [
>    result: find/case   str  ch   either equal?  result  none
>    [return 0] [return index? find/case str ch]
> ] ;I have  had to use find/case twice  because  if ; I  use
> index? find str ch ; and  i submit a  character that is not
> found in  str ; I get the  following error message from the
> interpreter **   Script    Error: index?  expected   series
> argument of   type: series  port   How can I    change this
> function so that I don't have to call find/case twice?
> 
> Thanks In advance Tim
> 
> 

Reply via email to