Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Counting # of semicolons in a string
Message
De
08/08/2008 02:38:23
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01337394
Message ID:
01337469
Vues:
12
This message has been marked as a message which has helped to the initial question of the thread.
>I am receiving a value that contains one or more names, each name is separated with a ; (semicolon). If the value only has 1 name, then there is no ; I am planning on using the STREXTRACT() method to separate the values, but I need to know how many semicolons there are to setup my loop. I know I could do a loop to go through each character in the value, and count that way, but I didn't know if there is a method to get the that count.
>
>
>lcNames=[NAMEONE;NAMETWO]
>or
>lcNames=[NAMEONE]
>
>Thanks
>
>Kirk

Instead of StrExtract(), I suggest you use GetWordNum().
For x=1 to occur(lcString,';')
  ? 'Name no.' + transform(x) + ' is '+GetWordNum(lcString,x,';') 
Endfor
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform