Skip to main content
April 24, 2008
Question

Truncating Dynamic Text

  • April 24, 2008
  • 4 replies
  • 341 views
Hello, I'm pulling in text via an XML file to populate part of my movie. The XML is being provided by and external vendor and contains more data than my movie will allow. The text field i'm looking to shorten is a list of names all seperated by commas. So, what I'm wanting to do is limit this list to two names, and I would think to do that i would need to search the string, tell it to count the first comma, but upon reaching the second comma, truncate the remaining text. thnoughts on how to do this because I haven't figured it out yet. thanks!
This topic has been closed for replies.

4 replies

kglad
Community Expert
Community Expert
April 24, 2008
you're welcome.
April 24, 2008
both of these worked. thanks everyone!
kglad
Community Expert
Community Expert
April 24, 2008
:

Inspiring
April 24, 2008
I think String.split() should do it for you - it'll return an array using a
specified delimiter. You could do something like:

var myArr = allNames.split(",");

and then myArr[0] and myArr[1] will get you the first two.

--
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/