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

comparing string function for .jxs

Participant ,
Aug 12, 2020 Aug 12, 2020

Copy link to clipboard

Copied

Hey everyone,

 

I'm using indesign script which is ( .jsx )  and it's totally diffrent from (.js).  Anyhow, are there any alternative for [ includes() or and comparing string function??]. I've tried 

if ("somedata" in path)

but it passes every time even if it's not in! 

 

i want to compare between image pathes.

 

thanks all.

TOPICS
Activation billing and install , Bug , EPUB , Feature request , How to , Import and export , InCopy workflow , Performance , Print , Publish online , Scripting , SDK , Sync and storage , Type

Views

478

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 , Aug 12, 2020 Aug 12, 2020

Look at the String.indexOf and String.match methods here: https://www.indesignjs.de/extendscriptAPI/indesign-latest/#String.html

if (str1.indexOf("str2") >= 0 ) 

or 

if (str1.match(/regularExpression/) 

Votes

Translate

Translate
Community Expert ,
Aug 12, 2020 Aug 12, 2020

Copy link to clipboard

Copied

Look at the String.indexOf and String.match methods here: https://www.indesignjs.de/extendscriptAPI/indesign-latest/#String.html

if (str1.indexOf("str2") >= 0 ) 

or 

if (str1.match(/regularExpression/) 

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
Participant ,
Aug 13, 2020 Aug 13, 2020

Copy link to clipboard

Copied

LATEST

Thanks! it worked for me!

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
Community Expert ,
Aug 12, 2020 Aug 12, 2020

Copy link to clipboard

Copied

Also:

Make sure you really have a string in your path variable and not a folder or a file object.

 

Regards,
Uwe Laubender

( ACP )

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