• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Same Strings returns false

Explorer ,
Nov 24, 2016 Nov 24, 2016

Copy link to clipboard

Copied

Hi

     Both Strings are not same for some reason even it looks same.One string came from Cmd>notepad>extendscript and other one is just a declared variable. Both are not same and returns false.Any thing i have to do with text encoding?? If so plz tell

//Example

//----------------------

var a= "A2F56"; (Serial number generated in command prompt and saved as text file and read in extend script)

var b="A2F56";

if(a==b){

return true;

}else{

alert("not today ");

}

//---------------

I appreciate ur help!!

Plz Check the screen shot below

eroor.png

TOPICS
Scripting

Views

525

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 25, 2016 Nov 25, 2016

Maybe you have some whitespace, linebreaks or whatever at the beginning/end of one of the strings? To verify this, you could check whether the length of the strings is identical. If the length is identical, you could iterate over all characters and see which of them are not identical.

Votes

Translate

Translate
Community Expert ,
Nov 25, 2016 Nov 25, 2016

Copy link to clipboard

Copied

Maybe you have some whitespace, linebreaks or whatever at the beginning/end of one of the strings? To verify this, you could check whether the length of the strings is identical. If the length is identical, you could iterate over all characters and see which of them are not identical.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 27, 2016 Nov 27, 2016

Copy link to clipboard

Copied

LATEST

String length was different and i have used replace("  ","") to clean the invisible double white space.Is there any way to just clean the string which outputs only visible characters,or bulk replace like : String.clean(\n \d @ $).

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines