On 3/4/06 10:00 PM, "Jim Witte" <[EMAIL PROTECTED]> wrote:

> How can I use a RegEx to strip trailing white-space?  I tried:
> 
> get matchText(theExpr, "(.*)\s*", theExpr)
> 
> where theExpr is "0025E95C mov      r5, r0                          "

Here's a version I have that trims whitespace from both sides of a string,
and includes 'normal' whitespace, along with hard spaces (watch word wraps):

function trim pWhat
  local dummy,tRetVal
  if the platform is "MacOS" then put "\xca" into tHardSpc
  else put "\xa0" into tHardSpc
  get matchText(pWhat, "(?s)^(\s|" & tHardSpc & ")*(.*?)(\s|" & tHardSpc &
")*$",dummy,tRetVal)
  return tRetVal
end trim

However using RegEx for trimming is not the fastest approach, although the
difference between 0.0391 ticks for the RegEx version vs. 0.0004 ticks for
the fastest version is not recognizable unless you have to do it thousands
of times...


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [EMAIL PROTECTED]

_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to