hi

i suggest to add 2 new lines (see 2 last lines in the following function) to 
the following function, so in case the parameter
includes only an email the result wont be an empty string, but the email 
itself. in order not to break backward behaviour,
we can add a new parameter with default value FALSE (name of parameter can be 
changed). please let me know what
do you think and whether you accept this fix. thanks.

function GetEmailDesc(Value: string; ReturnNonEmpty: boolean = FALSE): string;
var
  s: string;
begin
  Value := Trim(Value);
  s := SeparateRight(Value, '"');
  if s <> Value then
    s := SeparateLeft(s, '"')
  else
  begin
    s := SeparateLeft(Value, '<');
    if s = Value then
    begin
      s := SeparateRight(Value, '(');
      if s <> Value then
        s := SeparateLeft(s, ')')
      else
        s := '';
    end;
  end;
  Result := Trim(s);
  if (Result = '') and (ReturnNonEmpty) then
    Result := Value;
end;

-- 
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to