Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Chrtran for a phrase
Message
De
16/02/2005 19:28:52
 
 
À
16/02/2005 11:35:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00987482
Message ID:
00987727
Vues:
33
>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform