Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

String comparison, case insensitive

matteo_montalto
Contributor
0 Likes
4,684

Hi all experts,

I have a field, let's say SHORTTXT, which is a STEXT field that contains name and surname of a person; the order in which these two information are present in the string is not known a priori, and also the case should be irrelevant.

Now; given two field, say NAME1 and NAME2, I'd like to express the following condition, that should be case insensitive:

if NAME1 and NAME2 are both substrings of SHORTTXT....

What's the correct way to express this condition? Which cmp operator should I use? The 'contains' one seems to be case sensitive....

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,852

Hi,

Use the 'Contains String' i.e. 'CS' operation... If it doesnt work you can use 'TRANSLATE' first and then do the comparision..

9 REPLIES 9
Read only

Former Member
0 Likes
2,853

Hi,

Use the 'Contains String' i.e. 'CS' operation... If it doesnt work you can use 'TRANSLATE' first and then do the comparision..

Read only

0 Likes
2,852

sneha, CS is case-sensitive.

'ABcdEF' CS 'CD' returns false. That's not my desiderata. Thanks anyway

Read only

0 Likes
2,852

This also is a pretty basic question - you have to translate both to the same case.

Rob

Read only

0 Likes
2,852

Hi Matteo,

That is what i said... If it doesnt work please 'Translate' it to your desired forrmat and then check it..

Read only

0 Likes
2,852

Use translate statement

Read only

0 Likes
2,852

You don't have to translate.

'ABcdEF' CS 'CD'

returns true in my program.

Read only

0 Likes
2,852

>

> You don't have to translate.

Yup - seems to be true. But case sensitivity is a consideration in SELECTs. I guess that's what we were thinking.

Hat's off to you

Rob

Read only

Former Member
0 Likes
2,852

HI,,

IF SHORTTXT CS NAME1 and SHORTTXT CS NAME2

endif.

Thanks

Sudheer

Read only

matteo_montalto
Contributor
0 Likes
2,852

Thanks to you all, I thought there was a way to compare strings in a case-insensitive mode, anyway the suggested solution works as well.