Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Chrtran for a phrase
Message
From
16/02/2005 19:28:52
 
 
To
16/02/2005 11:35:51
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00987482
Message ID:
00987727
Views:
29
>Hi. Looking for a function (like chartran) that will eliminate a specified word from a field value without affecting same characters in other words therein.
>Is there a strtran()?
>
Another approach involving regular expressions.
function removeWord(lcString, lcWord)
  local re
  re = CREATEOBJECT('vbscript.regexp')
  re.IgnoreCase = .T.
  re.Pattern='\b' + m.lcWord + '\b'
  return re.Replace(m.lcString, '')
endfunc
Needs a little refinement to get rid of residual white space, but close.
Previous
Reply
Map
View

Click here to load this message in the networking platform