Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Single occurrence in a string
Message
De
27/03/2015 14:17:42
 
 
À
27/03/2015 13:25:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01617326
Message ID:
01617330
Vues:
80
J'aime (1)
>Hi All:
>
>How do I remove duplicate characters in a string:
>
>
>Bigstring = 'cattttccv'
>NonDupeString = NonDupe(BigString)
>
>* Result = 'catv'
>
>
>Thanks,
>
>Yossi
*NonDupe.prg
Lparameters tcString
Local lcReturn As String, ;
   lnX As Number
Create Cursor curDummy (myChar Char(1))
For m.lnX = 1 To Len(m.tcString)
   Insert Into curDummy Values (Substr(m.tcString, m.lnX, 1))
Endfor
Select Distinct myChar From curDummy Into Cursor curDummy
m.lcReturn = []
Scan
   m.lcReturn = m.lcReturn + myChar
endscan
use in CurDummy
Return m.lcReturn
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform