Hi Peter,

I use an alternative trim function that operates faster and removes excess space between words as well as at the start & end:

function trim pText
  put empty into tNew
  repeat for each word w in pText
    put w & space after tNew
  end repeat
  delete last char of tNew
  return tNew
end trim

Cheers,
Sarah

On 29/03/2005, at 7:33 PM, Peter Reid wrote:

function trimmed theText
  -- remove leading & trailing spaces
  put 1 into startCh
  put length(theText) into lenText
  put lenText into endCh
  repeat for each char c in theText
    if c <> space then
      exit repeat
    end if
    add 1 to startCh
  end repeat
  repeat with c = lenText to startCh step -1
    if char c of theText <> space then
      put c into endCh
      exit repeat
    end if
  end repeat
  return char startCh to endCh of theText
end trimmed

_______________________________________________ use-revolution mailing list [email protected] http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to