Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Transform code in function
Message
From
17/02/2014 08:48:44
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01594485
Message ID:
01594489
Views:
64
>Hi
>
>I developed a code to correct @Hotmail mistypes, but I have to use it in many parts of my software.
>
>Is it possible to transform it in a function, and which part of it can become a function ?
>
>
>
>select corrige_email
>
>SCAN FOR corrige_email.email_1 = " "
>
>   
>   IF   "@hotmail.com.br" $ corrige_email.email_x  .OR.;
>        "@hotimail" $ corrige_email.email_x  .OR. ".co.br" $ corrige_email.email_x .OR. ;
>        "@hotemail" $ corrige_email.email_x  .OR.;
>        "@hotamil" $ corrige_email.email_x  .OR.;
>        "@hotmais" $ corrige_email.email_x  .OR.;
>        "@hotml" $ corrige_email.email_x  .OR.;
>        "@hotmaiil" $ corrige_email.email_x  .OR.;
>        "@hotmil" $ corrige_email.email_x .or.;
>        "@hotmill" $ corrige_email.email_x .or.;
>        "@hotmaio" $ corrige_email.email_x .or.;
>        "@hotmai" $ corrige_email.email_x .or.;
>        "@htmail" $ corrige_email.email_x .or. "@homail" $ corrige_email.email_x .or.;                         
>        "@hotmaol" $ corrige_email.email_x .or.;
>        "@rotmail" $ corrige_email.email_x .or.;
>        "@hotmal" $ corrige_email.email_x .or.;
>        "@hotm" $ corrige_email.email_x .or.;   && se der certo substitui quase todos
>        "@hotmel" $ corrige_email.email_x 
>                STORE corrige_email.email_x TO lcValue  
>                      
>        replace corrige_email.email_1 with  LEFT(lcValue,AT("@",lcValue)-1)+"@hotmail.com"
>
> 
>
>   ENDIF
>   
>    ENDSCAN
>
>
Not much you can do but...
lcServer=getwordnum(corrige_email.email_x, "@", 2)
if inlist(lcServer, "hotm", "rotmail", "htmail", ...)
   replace corrige_email.email_1 with  getwordnum(corrige_email.email_x, "@", 1)+"@hotmail.com"
endif
Mind you, if you have "hotm" in this list, it will catch anything that begins with hotm, so the list doesn't have to be as long.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform