Posts: 76
Threads: 37
Joined: Nov 2018
i created a ICsv object and have a multi line string from a clipboard that i want to remove duplicates. When i compare the strongs by len they match, vusally they match, bring in Excel they math BUT dont match in my QM macro... also if i copy the string into a seperate macro, they still dont match.... If i copy the 1st line and duplicate it, it still wont match!!
is there an issue with the ICsv & strings or getting string the clipboard? even if you copy the text from my posting it still wont match... what am i doing wrong??
str a= "The ITypeLib interface provides access to information about the type description in a type library."
str b= "The ITypeLib interface provides access to information about the type description in a type library."
str c= "The ITypeLib interface provides access to information about the type description in a type library."
out a=b
out a=a
Posts: 1,338
Threads: 61
Joined: Jul 2006
08-03-2020, 02:04 AM
(This post was last modified: 08-03-2020, 02:26 AM by Kevin.)
out a=b is not the way to compare strings
best way is to use function
for more info read here
https://www.quickmacros.com/help/User/ID...StrCompare
or search the forum for StrCompare
Posts: 12,092
Threads: 142
Joined: Dec 2002
To compare str strings can be used a=b. out should be 1 if equal, else 0. But not lpstr strings.
Posts: 76
Threads: 37
Joined: Nov 2018
thanks. please copy my code above into your QM and try to do the string compare. either way it outputs 0, menaing none are equal even though they are the same
i am using the string from clipboard and placing it into a grid.... it constantly returns 0. please read my first post
Posts: 12,092
Threads: 142
Joined: Dec 2002
08-10-2020, 02:45 PM
(This post was last modified: 08-10-2020, 02:48 PM by Gintaras.)
str a= "The ITypeLib interface provides access to information about the type description in a type library."
str b= "The ITypeLib interface provides access to information about the type description in a type library."
str c= "The ITypeLib interface provides access to information about the type description in a type library."
out a=b
out a=a
out StrCompare(a b)
output:
1
1
0
Posts: 76
Threads: 37
Joined: Nov 2018
thanks. I get 3 0's in a row. it comes from the clipboard(i use the getClip function).
if you notice your 3rd one is 0, but the comparision its identical to the 1st one. Which outputs 1. why would they be different outputs...
a=b and strCompare(a b) both should equal 1
Posts: 1,338
Threads: 61
Joined: Jul 2006
08-14-2020, 05:37 PM
(This post was last modified: 08-14-2020, 05:40 PM by Kevin.)
out StrCompare(a b) is 0 when the strings are the same. Are you by chance converting the string to a csv before comparing ?. If you are that would explain the 0 on a=b.
Posts: 12,092
Threads: 142
Joined: Dec 2002
When two strings seem equal but aren't, the reason may be:
- one of strings ends with newline or space and you don't see it.
- the strings have different newlines, for example \r\n and \n.
- one of strings has invisible characters.
- some characters that look the same actually have different Unicode codes.
To see all codes in a string, use function outb:
str s="test"
outb s s.len 1