Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Single occurrence in a string
Message
De
02/04/2015 15:32:14
 
 
À
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:
01617726
Vues:
121
>Hi All:
>
>How do I remove duplicate characters in a string:
>
>
>Bigstring = 'cattttccv'
>NonDupeString = NonDupe(BigString)
>
>* Result = 'catv'
>
>
>Thanks,
>
>Yossi

FWLIW, My VFP solution, after reading Dragan's, was the same as Walter's except that I used CHRTRAN rather than STRTRAN.

My last APL coding was back in 1984. I've been trying to work out a solution, but I've forgotten too much.
So far all I can come up with is
teststring <-  teststring[< gradeup > teststring]  
bitmap <-  !=\teststring 
result <- bitmap / teststring.
(not sure if I remember exactly how not equal scan works. I "think" (hope) it gives a 1 when the values change.

Of course, if it were real APL it would be in one line


But I think I would be able to understand the real solution when I see it.

(Sorry Craig. I don't have the keyboard to show the proper glyphs for you)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform