Cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

Matching strings

Creator
Creator

I have a tablefile, in which I have to match strings in the first row.

Lets say column one has AAA15LW and columng two has AAA15RW .. These columns should be matched to get the same number.

 

So basically I can not use strRcopy to compare the strings because the 2 characters on the right are different, and I also cannot only compare the numbers in the string because this is not specific enough (there are multiple columns with 15, but only 2 with AAA15 at the start).

 

Can somebody help?

 

Thanks in advance,

-T

4 REPLIES 4

Re: Matching strings

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello ThiagoT,

 

can you describe the exact condition when two strings match?

 

Regards,

Ralf

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Matching strings

Creator
Creator

Hi Ralf,

 

either:

 

Two strings must match, if all characters are identical, except for the last 2.

or

Two strings must match, if all characters are identical, except for the second to last character

 

 

Re: Matching strings

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi ThiagoT,

 

the following code prints true if your first condition is met:

 

is
do
    local s1:string := "AAA15xx";
    local s2:string := "AAA15yy";
	
    print copy(s1, 1, strlen(s1)-2) = copy(s2, 1, strlen(s2)-2);
end;

 

And this is the test for your second condition:

is
do
    local s1:string := "AAA15xx";
    local s2:string := "AAA15yx";
	
    print copy(s1, 1, strlen(s1)-2) = copy(s2, 1, strlen(s2)-2) AND
	  copy(s1, strlen(s1), 1) == copy(s2, strlen(s2), 1);	
end;

 

Regards,

Ralf

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Matching strings

Creator
Creator

Thanks a lot!