Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Obtain requred words from a string
Message
De
03/12/2004 06:04:47
 
 
À
03/12/2004 05:53:52
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:
00966631
Message ID:
00966634
Vues:
9
String1=LEFT(ctext,AT(' ',ctext,5))
String2=SUBSTR(ctext,AT(' ',ctext,5)+1)
>Dear Sir,
>
>I have a string ctext, to get fifth word I use following codes, it works fine.
>But I want to extract first five words into a variable var1 and rest words into other variable var2 as follows
>
>var1=Two million five hundred forty
>var2=seven thousand eight hundred ninety six only
>
>What should I do get above result?
>Please modify following codes or suggest some other codes.
>
>Thanks in advance
>
>
>
>ctext=alltrim("Two million five hundred forty seven thousand eight hundred ninety six only")
>NFIELDNO=5
>
>cAnswer = ''
>If nFieldNo > occu(' ',cText)+1
>   Return ''
>Endif
>
>If nFieldNo = 1
>   nAnswer = subs(cText,1,at(' ',cText)-1)
>Else
>   cText   = subs(cText,at(' ',cText,nFieldNo-1)+1)
>   If ' '$cText
>      nAnswer = subs(cText,1,at(' ',cText)-1)
>   Else
>      nAnswer = cText
>   Endif
>Endif
>
>?nAnswer
>
>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform