Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Range of values
Message
De
05/11/2001 22:27:09
 
 
À
05/11/2001 15:37:15
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00577572
Message ID:
00577774
Vues:
17
>Does anybody have a function that converts a range of values into individual values? The best example, I think, is the range of pages in newer versions of MS-Word, where the user can type "1, 3-5, 7". I want this converted to a form that can easily be processed, like the string "1, 3, 4, 5, 7", or an array or cursor with the corresponding elements.
>
>I am sure I can write the function myself, but it seems to me this is a rather involved procedure.
>
>Hilmar.




I have similar question before in UT.

Solution reply was #561827

The main skill to do is:

ALINE(aa,chrtran(pcCNums,",",chr(13))) && get comma-separated items into array

Then you can handle each element with single value or simple range...
Benefit is you can easy check any duplicate entry.

For example: 2-7, 3, 6-10
(3, 6, 7 are duplicate)


p.s. Aline() is VFP6 function, Since I still using VFP5, i rewrote aline2 myself.
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform