At 04:22 PM 6/25/2015, jan johansen wrote:
Group,
I need to run a cursor to get a comma separated list of emails.
My solution ends up with a comma in the last position of the TEXT string.
How would you trim the last comma off?
Jan,
If the last character is ALWAYS a comma, and if you need to eliminate that,
use a simple technique to achieve your goal:
-- Example:
SET VAR v1 TEXT = '[email protected],[email protected],[email protected],'
SET VAR v2 TEXT = (SGET(.v1,(SLEN(.v1)-1),1))
RETURN
The resulting variable v2 will be the exact same as v1, but without the
last comma.
Hope that helps!
Razzak