To be rigorous, per Wol's final sentence, if any legitimate LF
(char(10)) or CR (char(13)) occurred in the INPUTVAR string outside
the CRLF pair, they too would be stripped out by
CONVERT CHAR(10):CHAR(13) TO '' IN INPUTVAR.
or the equivalent
INPUTVAR = CONVERT( CHAR(10):CHAR(13), '', INPUTVAR )
As long as you are sure that this will never be the case, CONVERT does
it & is much cheaper in execution than the safer:
INPUTVAR = CHANGE( INPUTVAR, CHAR(10):CHAR(13), '' )
On 4/26/2012 7:36 AM, Wols Lists wrote:
Except that CONVERT will take a from list and a to list. Much as Wil
winds me up,he is spot on here.
I often use that trick when validating input - if say I only want
numbers I will do something like
JUNK = CONVERT( "01234567890", "", INPUTVAR)
CONVERT JUNK TO "" IN INPUTVAR
It relies on CONVERT replacing the xth from-char with the xth to-char,
and if the to-string is null it effectively deletes all characters in
On 26/04/12 01:07, Tony Gravagno wrote:
I don't recall about which platforms this applies, but CONVERT is used
to change a single character. CHANGE or SWAP (depending on platform)
changes multiple chars:
CONVERT SINGLE1 TO SINGLE2 IN VAR
VAR = CHANGE(VAR,MULTI1,MULTI2)
VAR = SWAP(VAR,MULTI1,MULTI2)
CONVERT CHAR(10):CHAR(13) TO "" IN X.ID work?
From: Greg Coelho
Any suggestions how I can use CONVERT to strip ASCII control
characters EC 010 and 013 (LFCR) from a variable?
CONVERT '?' TO '' IN X.ID
U2-Users mailing list