Creative COW SIGN IN :: SPONSORS :: ADVERTISING :: ABOUT US :: CONTACT US
Creative COW's LinkedIn GroupCreative COW's Facebook PageCreative COW on TwitterCreative COW's Google+ PageCreative COW on YouTube
ADOBE AFTER EFFECTS:HomeForumBasicsExpressionsTutorialsPodcastsAE TechniquesTrainingCreative Cloud DebateFAQ

How to remove the first three characters from a string and display the rest?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook

Dave MartinHow to remove the first three characters from a string and display the rest?
by on Sep 2, 2012 at 2:54:05 pm

Hi All,

I'm making a score sheet to display: Position and Runner Name.

There is a main Comp called "Event_Name" and within this there are several Comps called:
"01 Runner Name"
"02 Runner Name"
"03..."

So for I've got the position and the runner name to show, See below

the_place = comp("Event_Name").layer(thisComp.name).index;
the_name = comp("Event_Name").layer(thisComp.name).name ;
divider = " " ;
the_place + divider + the_name

In line [2] the name of the comp is what I want to be displayed. However, in order to keep these layers in order in the project window and the "Event_Name" comp I have to name them as such:
01 Runner Name
02 Runner Name
03...

What I need to do in line [4] is just display the 'Runner Name' but without the first 3 characters I.E. "01 ".
So I need to remove the first 3 characters and display the rest - NOTE: Comp Names are all different lengths :(

Cheers,

Dave.


Return to posts index
Reply   Like  
+1


Xavier GomezRe: How to remove the first three characters from a string and display the rest?
by on Sep 2, 2012 at 3:49:23 pm

Strings have a slice method: .slice(m,n)
It removes the first m characters, keeps m-n, and removes the rest.
the second parameter is optionnal so if n is not specified, .slice(m) removes the first m characters and keeps the rest.

so maybe you can replace line[4] by

the_place + divider + the_name.slice(3)


-----

Xavier


Return to posts index
Reply   Like  
+1

Dave MartinRe: How to remove the first three characters from a string and display the rest?
by on Sep 3, 2012 at 4:00:46 am

PERFECT!!! EXACTLY WHAT I NEEDED!

Thank you Soooooo Much Xavier


Return to posts index
Reply   Like  

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook


FORUMSTUTORIALSMAGAZINESTOCKYARDVIDEOSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

Creative COW LinkedIn Group Creative COW Facebook Page Creative COW on Twitter
© 2013 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]