How to compare two strings using DXL

Hello,

I am trying to compare two stringsfor that I had used following function but its not giving satisfied answer. 

int check = cistrcmp(serviceAbstract,alreadyPresentServiceAbstract)
 

check value is -1 for matching value also.

Can you please help me out or suggest something else?

Thanks and Regards,

Hemlata


HemlataS - Mon Jun 10 05:11:38 EDT 2013

Re: How to compare two strings using DXL
BillTidy - Mon Jun 10 06:29:27 EDT 2013

I run your code and it gives me 0 for an exact match.

-1 means your first string has a lower value than your second string. Is there whitespace at the end of the string alreadyPresentServiceAbstract ?

 

Check the DXL help... Here's a snip from it...

 

Declaration
int cistrcmp(string s1,
               string s2)
Operation
Compares strings s1 and s2 without regard to their case, and returns:

 0  if  s1 == s2  
1  if  s1 > s2  
-1  if  s1 < s2  


Example
print cistrcmp("aAa","AaA")    // prints 0
print cistrcmp("aAa","aA")     // prints 1
print cistrcmp("aAa","aAaa")   // prints -1
 

Re: How to compare two strings using DXL
HemlataS - Mon Jun 10 08:59:50 EDT 2013

BillTidy - Mon Jun 10 06:29:27 EDT 2013

I run your code and it gives me 0 for an exact match.

-1 means your first string has a lower value than your second string. Is there whitespace at the end of the string alreadyPresentServiceAbstract ?

 

Check the DXL help... Here's a snip from it...

 

Declaration
int cistrcmp(string s1,
               string s2)
Operation
Compares strings s1 and s2 without regard to their case, and returns:

 0  if  s1 == s2  
1  if  s1 > s2  
-1  if  s1 < s2  


Example
print cistrcmp("aAa","AaA")    // prints 0
print cistrcmp("aAa","aA")     // prints 1
print cistrcmp("aAa","aAaa")   // prints -1
 

Thanks for your reply.

Hemlata