Six Stars

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.

2 REPLIES
Employee

Re: Fatest way to check that a string corresponds to criterias?

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.

 

image.png

 

 

Warm Regards,

 

Nikhil Thampi

Nine Stars

Re: Fatest way to check that a string corresponds to criterias?

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.