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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Fatest way to check that a string corresponds to criterias?

Hi,

 

If I got a random string and I want to make some checks to see if it's valid or not. For example string must start with '1', length must be 20, fifth character must be different from '0' and such things like that...

 

What is the fatest way to achieve such verifications? I can use regex patterns if needed.

 

I thought about using a tJava with plain java text but maybe there is better ways.

 

Thank you for your help.

Labels (3)
2 Replies
Anonymous
Not applicable
Author

Hi,

 

     The easiest way will be to use the various functions in the tmap. You can also use java functions and regex functions also apart from standard functions provided in below list.

 

0683p000009LznU.png

 

 

Warm Regards,

 

Nikhil Thampi

Jesperrekuh
Specialist
Specialist

The fastest way is to rank your checks on % of occurrences on, highest -> lowest ... and code logic according to these metrics.

Example if 99.9% of your strings have a length of >= 20 and
75 % of your strings starts with a one... You will start a comparison whether its a one, next length...
Use regex for complex comparison and simple string functions for other comparisons.

Increasing code logic will result in poor(er) performance, keep it clean.
However, I wouldn't care to much about overhead on string comparison and checks.
If you are able to do it on (raw) bytes or a numerical representation you will improve overall performance.