Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Converting a memory variable with character and numeric
Message
De
23/12/2014 04:18:38
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
22/12/2014 19:42:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01612566
Message ID:
01612609
Vues:
47
>>Is there more concise way of converting a memory variable from A15 to A14
>>Here's what i have - seems a tad convoluted to me. Maybe i should just be grateful i got it on one line.
>>
>>n1="A15"
>>n2="A"+LTRIM(STR(VAL(SUBSTR(n1,2,2))-1))  &&& gives me n2=A14
>>
>>tnx
>>k
>Don't know if you need this or not..........taking Borislav's solution and making it generic so that it isn't for just two characters

>n2 = "A" + TRANSFORM(VAL(SUBSTR(n1,2)))

And this keeps working below 10. The trouble with transform() without picture parameter sometimes gives you unexpected result - with decimals etc. If two-digit result is desirable, then I'd rather have

n2 = "A" + TRANSFORM(VAL(SUBSTR(n1,2)), "@L 99")

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform