Skip to content

Instantly share code, notes, and snippets.

@animoplex
Created September 5, 2018 00:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save animoplex/40663fc6584e80f4de3c734dcd5c749f to your computer and use it in GitHub Desktop.
Save animoplex/40663fc6584e80f4de3c734dcd5c749f to your computer and use it in GitHub Desktop.
Substring Examples - After Effects Expression by Animoplex
// Substring Expressions - Created by Animoplex: www.animoplex.com
// Some advanced examples of substrings and text formatting combinations.
// Full Tutorial: https://www.youtube.com/watch?v=oz352OsNgnI
// Substring Examples
name.substr(0, 2) // Output everything between 0 and 2
name.substr(2, name.length) // Output everything between 2 and the last character
name.substr(name.length - 1, 1) // Output the last character
// Bonus Substring Example
// Outputs "Comp Name: MainComp" and "Revision Number: 06", assuming the comp name's format is "MainComp06"
src = thisComp.name;
myName = src.substr(0, src.length - 2);
myVersion = src.substr(src.length - 2, 2);
"Comp Name: " + myName + "\r" + "Revision Number: " + myVersion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment