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: 
qw_johan
Creator
Creator

Easy way to check if a certain character is a number?

Hi!

Is there an easy way to check if a certain character is a number?
Right now I am using ..
PurgeChar(str, '0123456789') as test

This works but removes all numbers from the string. What I am after isa way to check if the second character
is a number. Depending on if it's true or not, only use the first letter otherwise the complete string.

I've also tried this (no success)...
if(NumCount(str)<1, str, Left(str,1)) as test

Thanks

1 Solution

Accepted Solutions
Not applicable

Try this

if(IsNum(Left(Mid(str,2),1)),str,Left(str,1))

Thanks,

Aline

View solution in original post

3 Replies
Not applicable

Try this

if(IsNum(Left(Mid(str,2),1)),str,Left(str,1))

Thanks,

Aline

qw_johan
Creator
Creator
Author

Thanks for your quick reply.
Just what I was after.

Thanks

Not applicable

thanks