Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to remove space and bracket in numbers?


Hi,

I have phone number as below

00353 (0) 87 1706453

I can remove leading zeroes by using below function.

Replace(Replace(Ltrim(replace(replace(replace(Number,' ','_'),0,' '),'+',' ')),' ',0),'_',' ') as Number_1

can anyone help me how to remove spaces and brackets

how to replace 4765 in place of 0 which is in first place for below number

0504634545

Thanks.

15 Replies
Anonymous
Not applicable
Author

Have a look at the PurgeChar() function.

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Or better still, the keepchar function:

KeepChar(Number, '0123456789')

You can also add in other characters, such as period and comma, if you want to keep those also.

Steve

Not applicable
Author

Num(Trim(PurgeChar([Field1],'-+()')))

will turn

00353 (0) 87 1706453

into

3530871706453

which is a believe what you are ultimately after?

hope that helps

Joe

shree909
Partner - Specialist II
Partner - Specialist II

Hi

Use which ever works  for you

=Mid(KeepChar(Number, '0123456789'),3)  or  if you are getting 00 at the begining use and if condition

=If(Mid(KeepChar(Number, '0123456789'),1,2)='00',Mid(KeepChar(Number, '0123456789'),3),KeepChar(Number, '0123456789'))  AS  Number_1

kushalthakral
Creator III
Creator III

Hi Amelia

Please use below formual, it will fulfill you requirement

num(Mid(KeepChar(Number, '0123456789'),3))


please check below image

test.png

MarcoWedel

Num(KeepChar(Number, '0123456789'))

MarcoWedel

='4765'&Replace(LTrim(Replace(KeepChar('00353 (0) 87 1706453', '0123456789'),'0',' ')),' ','0')

QlikCommunity_Thread_143709_Pic1.JPG.jpg

hope this helps

regards

Marco

MarcoWedel

The "Num(KeepChar(Number, '0123456789'))" approach I posted before does not work for numbers as long as your example because it can't be intertreted as an integer (to long).


hope this helps


regards


Marco

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi Amelia

I suggest may be try this

=4765 & Mid(KeepChar('00353 (0) 87 1706453','0123456789'),3)

Hope it helps

Gabriel