Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
To handle a character string
Message
From
22/04/2006 13:19:51
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01115703
Message ID:
01115711
Views:
6
This message has been marked as a message which has helped to the initial question of the thread.
>Hi all,
>
>I must reimport an address file.
>
>"Rue de l'université 7 " =====> "Rue de l'université"
>"place victor hugo 7Bte 15" ====> "place victor hugo"
>"rue des mineurs 14b" =====> "rue des mineurs"
>etc...
>
>A small assistance for this action ?
>
>thank in advance for help
>
>bernhart

Today's exercise in "help-a-fellow-programmer"
?roadname("Rue de l'université 7") && Rue de l'université

Function justroadname
Lparameters pcRoad
If Pcount()<1 Or Vartype(pcRoad)#'C'
  Return ''
Endif 
Local lnWord, lcReturn, lnWordcount
lnWordcount=Getwordcount(pcRoad)
lcReturn=''
For x=1 To lnWordCount
  If Val(Getwordnum(pcRoad,x))=0
    lcReturn=lcReturn + Getwordnum(pcRoad,x) + ' '
  Else 
    Exit 
  Endif 
Endfor 
Return Trim(lcReturn)
I see that Viv had the same idea..! Another soulution is to remowe the last word if val(lastword)>0. Not 100% safe, but will remove most of the ambigous house numbers.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform