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