Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

formating

I am trying to find a function QlikView to format a character string.
For example:
Transforming "H * / 2Q_?*Z6" to "H2QZ6".
That is to say, I want to keep only the letter and number in the character string

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hello,

Using KeepChar and PurgeChar functions will work for you:

=PurgeChar('H / 2Q_?*Z6', '/ _?*')


Or

=KeepChar('H / 2Q_?*Z6', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')


Hope that helps

View solution in original post

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

From the manual:

KeepChar( s1, s2 )
Returns the string s1 less all characters not contained in string s2.
Example:
keepchar( 'a1b2c3' , '123' ) returns '123'.

In your case: =KeepChar('H * / 2Q_?*Z6','ABCDEFGHIJK:LMNOPQRSTUVWXYZ0123456789');

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Miguel_Angel_Baeyens

Hello,

Using KeepChar and PurgeChar functions will work for you:

=PurgeChar('H / 2Q_?*Z6', '/ _?*')


Or

=KeepChar('H / 2Q_?*Z6', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')


Hope that helps