September 6, 200619 yr This must exist, but I haven't been successful at finding it.. Has anyone seen a custom function that will parse the "From" field in an email ? "Full Name" to--> first name: last name: email address: The tricky part is that Full Name can be last, first first last first initial last first mi. last etc. I'm writing something that takes a good guess at this, and realize nothing will be perfect because of the crap in crap out rule.. (if a person has "yoda" in for their full name, my function will fail.. but I want to take the best possible stab? Am I reinventing the wheel and if so, can someone point me to it ? thanks :)
September 6, 200619 yr Since there seems to be no way to determine what order the name appears, you're likely to get more bad data than you want. Its not difficult to separate any words in a "full name" but I don't know how you can determine which is the first, middle or last.
September 6, 200619 yr Author Something like this does the trick.. about 90-95 % of the time to parse/guess the First Name out.. Let ( [ Lquot = Position(From; """; 1; 1); Rquot = Position(From; """; 1; 2); Lbrac = Position(From; "<"; 1; 1); Rbrac = Position(From; ">"; 1; 1); Name = Middle(From; Lquot+1; Rquot-(Lquot+1)); Email = Middle(From; Lbrac+1; Rbrac-(Lbrac+1)); comma = Position(Name; ","; 1; 1) ]; Case( PatternCount(Name;",") >0 ; Middle(Name; comma+2; (Rquot-(comma+2))); LeftWords(Name; 1) ) ) My situation is one where the data entry person will have to check the name anyway, so parsing this and dumping it onto a layout will be a bit timesaver. Are there any problems with this code?
Create an account or sign in to comment