Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Are Keepchar & Purgechar case sensitive?

Are keepchar & purgechar case sensitive?  For example, if I want to purge all occurrences of the letter E (both upper and lower case), would I need to say  purgechar(FIELD1,'Ee') as NEW_FIELD

8 Replies
MK_QSL
MVP
MVP

Yes PurgeChar and KeepChar are case sensitive.

You need to write...

PurgeChar(FIELD,'Ee') as NEW_FIELD

el_aprendiz111
Specialist
Specialist

Hi,

1 example:

PurgeChar(FIELD,'0123456789$*-@#&') AS FIELD_CLEAR,
KeepChar(FIELD_CODE,'0123456789') AS CODE_CLEAR;

LOAD * Inline
[
FIELD, FIELD_CODE
Jhons09&5, 0001DSFJHDS
Alf$*--15, 0002SDFSSDS
Don@#$,    DFDSFSDR0003DSFJHDS
Mich0123456789, DFGDFRG0004DSFJHDS

]
;

el_aprendiz111
Specialist
Specialist

escese me:

LOAD *,
PurgeChar(FIELD,'0123456789$*-@#&') AS FIELD_CLEAR,
KeepChar(FIELD_CODE,'0123456789') AS CODE_CLEAR;
LOAD * Inline
[
FIELD, FIELD_CODE
Jhons09&5, 0001DSFJHDS
Alf$*--15, 0002SDFSSDS
Don@#$,    DFDSFSDR0003DSFJHDS
Mich0123456789, DFGDFRG0004DSFJHDS

]
;

sunny_talwar

Or you can do this:

PurgeChar(Upper(FIELD1),'E')


or


PurgeChar(Lower(FIELD1),'e')

swuehl
MVP
MVP

Sunny, wouldn't this potentially change also the case of characters one may want to keep?

sunny_talwar

Yes it would ...

But at times that might be acceptable. In times it is not, I would use Manish's script

Clever_Anjos
Employee
Employee

afaik almost all qv functions are case sensitive

Not applicable
Author

Thanks much.