Skip to content

Instantly share code, notes, and snippets.

@animoplex
Last active April 11, 2018 20:53
Show Gist options
  • Save animoplex/f3d8b95b1729a986b80183830385e6eb to your computer and use it in GitHub Desktop.
Save animoplex/f3d8b95b1729a986b80183830385e6eb to your computer and use it in GitHub Desktop.
Output Layer Name As Substring - After Effects Expression by Animoplex
// Output Layer Name As Substring - Created by Animoplex: www.animoplex.com
// Output Last Character
lst = name.substr(name.length-1, name.length);
// Output First Character
lst = name.substr(0, 1);
// Output All Except First Two Characters
lst = name.substr(2, name.length);
// Other String Methods:
// Outputs 2 characters, starting after the first character.
myString.substr(1, 2)
// Outputs everything after the first character, through the second character.
myString.substring()
// Converts the string to all uppercase letters.
myString.toUpperCase()
// Converts the string to all lowercase letters.
myString.toLowerCase()
// Returns the last character of a string.
myString.slice(-1)
// Returns a string as an array with items split at the specified character.
myString.split("-")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment