Skip to main content
schlindibus
Inspiring
February 9, 2022
Answered

INDD: Check if LayerName contains specific Char

  • February 9, 2022
  • 1 reply
  • 604 views

Hello guys

 

I was wondering how to check if a specific char is contained in the layer name.
Tried .contains("_") and .include("_") but neither worked...

 

Does anyone know the Answer to this question?

 

Thanks a lot

This topic has been closed for replies.
Correct answer GNDGN

Hey, try with indexOf:

'My_Layer'.indexOf('_') > -1; // returns true
'MyLayer'.indexOf('_') > -1; // returns false

 

1 reply

GNDGN
GNDGNCorrect answer
Inspiring
February 9, 2022

Hey, try with indexOf:

'My_Layer'.indexOf('_') > -1; // returns true
'MyLayer'.indexOf('_') > -1; // returns false

 

____________________Robotic Process Automation in Desktop Publishing (Book): https://doi.org/10.1007/978-3-658-39375-5
schlindibus
Inspiring
February 9, 2022

@GNDGN  You're the Man 🙂

 

I forgott about .indexOf... ups

 

Thanks for your extremely fast reply!

 

Sunil Yadav
Legend
February 12, 2022

Or may be you can try match:

'My_Layer'.match('_') != null

Best

Sunil