| Translate := @GetProfileField(
"Input";"PhoneTranslation");
@If( Translate!="";@Return("Set.AlreadyDone");""); ProfileValue := " FieldVal := @ThisValue; WellFormed := \"{+}+{0-9-}{ }{(}+{0-9}{)}+{0-9-}\"; Extention := \"{ }{e}{ }+{0-9}\"; @If( @Matches( FieldVal; WellFormed); @Return(FieldVal); @Matches( FieldVal; WellFormed +Extention); @Return(FieldVal); \"\"); StripFormat := \"+\":\" \":\"(\":\")\":\".\":\"-\":\" \"; NoFmt := @ReplaceSubstring( FieldVal;StripFormat;\"\"); RTNValue := @If( @Left( NoFmt;1) = \"1\" & @Length( NoFmt) = 11; \"+1 (\" +@Middle( NoFmt;1;3) + \")\" + @Middle( NoFmt;4;3) + \"-\" + @Middle( NoFmt;7;4); @Left( NoFmt;1) != \"1\" & @Length( NoFmt) = 10; \"+1 (\" +@Middle( NoFmt;0;3) + \")\" + @Middle( NoFmt;3;3) + \"-\" + @Middle( NoFmt;6;4); FieldVal); @return(RTNValue); "; @SetProfileField( "Input";"PhoneTranslation";ProfileValue); Translate := @GetProfileField( "Input";"PhoneTranslation"); @If( Translate!=""; @Return("Set.Success"); @Return("Set.Failed")) |
BlogSphere
Join The WebLog Revolution at BlogSphere.net