Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String conversion problem
Message
De
09/05/2005 02:59:24
 
 
À
09/05/2005 02:50:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 6
OS:
Windows '98
Network:
Windows 98
Database:
Visual FoxPro
Divers
Thread ID:
01012102
Message ID:
01012104
Vues:
21
>Dear Experts
>
>Please correct this command line
>
>a=alltrim(substr(str(YEAR(date())),1,4))
>
>I want to extract last two characters of year i.e. 05
>
>Please help

Check the help on str()
&& breaking it down gives

? str(YEAR(date())) && returns a string of length 10, six spaces and 2005
?substr(str(YEAR(date())),1,4)  && results in 4 blanks
?alltrim(substr(str(YEAR(date())),1,4)) && returns the empty string

either
?substr(str(YEAR(date()),4),3,2)

or 
?substr(dtos(date()),3,2)
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform