Get String document. equalsIgnoreCase is differ

I got some String document and print log and compare log string and string but is differ

String signatureKey = bucket.defaultCollection().get(documentID,GetOptions.getOptions().transcoder(
                RawStringTranscoder.INSTANCE)).contentAs(String.class);
log.info("signatureKey : {}", signatureKey);                                 // Print "abc"
log.info("same ? : {}", "abc".equalsIgnoreCase(signatureKey)); // Print false

Why differ? I can`t understand.
Then It is same If I get String like under code.

String signatureKey = bucket.defaultCollection().get(documentId).contentAs(String.class);

I use couchbase server 6.0.0 and java sdk version 3.4.0

Does the first log.info output line include the quotes? i.e.

signatureKey : "abc"

or is it:

signatureKey : abc

?

(i.e. Could it be that the second needs to be "\"abc\"".equalsIgnoreCase(signatureKey) ?)

More specifically: If the document stored already includes the quotes, the RawStringTranscoder will not do anything to remove/interpret the quotes and you have to deal with them as part of the result. The default behaviour will interpret/handle the quotes and allow you to retrieve just their content.
(Ref: https://docs.couchbase.com/java-sdk/current/howtos/transcoders-nonjson.html#rawstringtranscoder )

1 Like

log printed like signatureKey : “abc”
Thank you u r comment.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.