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

Extendscript: How to check string ends with

Participant ,
Nov 30, 2017 Nov 30, 2017

Copy link to clipboard

Copied

Hello All,

How to check a string ends with a particular string in extendscript? Where can I find the string api?

Premiere Pro Version: 12.0.0
Extension Type: Panel

Thanks & Regards,
Meet Tank

TOPICS
SDK

Views

3.5K

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

Engaged , Dec 01, 2017 Dec 01, 2017

Hi Meet,

you mean like typing "String." in ExtendScript Toolkit CC, revealing the String methods?

You could use .substr with a negative offset (ex.: substr(-8,8) returning the last 8 characters of the string), or .match and use a regular expression like /[.]*edit/ , returning true if the string ends with "edit".

Best,

Erik

Votes

Translate

Translate
Engaged ,
Dec 01, 2017 Dec 01, 2017

Copy link to clipboard

Copied

Hi Meet,

you mean like typing "String." in ExtendScript Toolkit CC, revealing the String methods?

You could use .substr with a negative offset (ex.: substr(-8,8) returning the last 8 characters of the string), or .match and use a regular expression like /[.]*edit/ , returning true if the string ends with "edit".

Best,

Erik

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
New Here ,
Dec 03, 2017 Dec 03, 2017

Copy link to clipboard

Copied

Hi Meet,

You can also add this function to your script :

String.prototype.endsWith = function( str ) {

    return this.substring( this.length - str.length, this.length ) === str;

  };

And then use it as a string method.

var a = "Hello Meet";

a.endsWith("Meet") --> will return true.

Cheers,

Peleg

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
Engaged ,
Dec 03, 2017 Dec 03, 2017

Copy link to clipboard

Copied

LATEST

Neat!

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