|
Strip whitespace from the beginning and end of a string |
|
SourceString |
The string that is to be trimmed form whitespace. |
|
global
updating procedure CreateContactFromMailsm()
begin
record MailVc Mailr;
row MailVc Mailrw;
Integer i,rwcnt,j,wn,nwn;
record CUVc CUr;
string 255 name;
string 255 email;
LongInt stpos,atpos,adlen;
Boolean foundf;
//curmailbox = CurMailboxName;
wn = CurWindow;
DeselectWindow(wn,false);
GetWindowRecord(wn,Mailr);
rwcnt = MatRowCnt(Mailr);
for (i = 0; i<rwcnt; i = i + 1) begin
MatRowGet(Mailr,i,Mailrw);
if (Mailrw.RowTyp==kMailRowTypeFrom) then begin
RecordNew(CUr);
foundf = FindEmbeddedEmail(Mailrw.AddrCode,stpos,atpos,adlen);
if (foundf) then begin
email = trim(mid(Mailrw.AddrCode,stpos + 1,adlen - 2));
name = trim(left(Mailrw.AddrCode,stpos));
end else begin
if ((atpos>0) and (HasIllegalChar(Mailrw.AddrCode)==false)) then begin
email = trim(Mailrw.AddrCode);
name = "";
end;
end;
CUr.eMail = email;
CUr.Name = name;
nwn = OpenWindow("CUDClass",1,0,"","",CUr);
end;
end;
return;
end;
««