Ignore punctuation when addressing word n of a string

Monte Goulding monte at sweattechnologies.com
Mon Aug 11 19:55:01 EDT 2003


> I have a string such as "now, that is a string!"  But when I
> address word n
> of the string, I get "now," (when n = 1) and "string!" for (when n = 5).
> How can I point to a string and get only the nth word, without any
> contiguous punctuation getting in the way?

You could try token 1 of word n but that's not really reliable. My
suggestion is to have a stripPunctuation function.

function stripPunctuation pString
  repeat for each char tChar in ",.:;?()!"
    replace char tChar with "" in pString
  end repeat
  return pString
end stripPunctuation

Cheers

Monte
>
> Thanks in advance,
>
> Mark Powell
> Production Manager
> VERITAS Education
>
>
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list