nafa2221
asked on
Trim String
I need to trim a string. The string is something like it is below.
Welcome, Brian!
I need to trim that so it only has brian, the name may vary in lenght and there may sometimes be comments after the ! so I will need to trim everything after the ! and then !. I also need to trim the Welcome,. Thanks!
Welcome, Brian!
I need to trim that so it only has brian, the name may vary in lenght and there may sometimes be comments after the ! so I will need to trim everything after the ! and then !. I also need to trim the Welcome,. Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
this example does the trimming you
want:
var
MYSTRING, NEWSTRING : STRING;
begin
MYSTRING := 'Welcome, Brian! abcd';
NEWSTRING := (COPY (MYSTRING, POS (' ', MYSTRING), (POS('!', MYSTRING) - POS (' ', MYSTRING))));
end;
Greetings, Alex
this example does the trimming you
want:
var
MYSTRING, NEWSTRING : STRING;
begin
MYSTRING := 'Welcome, Brian! abcd';
NEWSTRING := (COPY (MYSTRING, POS (' ', MYSTRING), (POS('!', MYSTRING) - POS (' ', MYSTRING))));
end;
Greetings, Alex
ASKER
fullwindowtext := extractname(fullwindowtext
and I get an error about strings not being compatible with arrays. Thanks