Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

chr(32) + chr(160) as spaces in string. How to eliminate in one step?

Hello QVer
I want to compare two strings if there are differences between 2010 and 2011.
Superficially seen there is no diff. but when matching them with i.e. match function the result is 0.
The reason I found is that there are two spaces [chr(32) + chr(160)] responsible for the diff.
Example:
2010: "ABC > DE F" = "ABC > DEF" [after removing chr(32) with replace function]
2011: "ABC > DE F" = "ABC>DE F" [after removing chr(160) with replace function]
My goal is "ABC>DEF"

Now I want to standardise them in making strings without spaces.
The only way to do I found the function replace in two steps.

Does anybody have an idea to solve that in one step?
Thanks and greetings
dj_skbs [QV 90074408SR3]

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hello,

Depending on what your field has, one solution is using the following in your load script:

KeepChar(Field, 'ABCDEFGHIJKLMNOPQRSTUVXYZ><') AS Field


or the opposite

PurgeChar(Field, chr(32) & chr(160)) AS Field


Hope that helps

View solution in original post

3 Replies
Not applicable
Author

Look this in help: PurgeChar( s1 , s2 )

Returns the string s1 less all characters contained in string s2.

-Alex



Miguel_Angel_Baeyens

Hello,

Depending on what your field has, one solution is using the following in your load script:

KeepChar(Field, 'ABCDEFGHIJKLMNOPQRSTUVXYZ><') AS Field


or the opposite

PurgeChar(Field, chr(32) & chr(160)) AS Field


Hope that helps

Not applicable
Author

Solved with

PurgeChar(Field, chr(32) & chr(160)).

I tried everything also with Purgechar but not with the "&" combination.

Thank You Miguel + Alexandru

dj_skbs