Created
May 26, 2012 03:58
-
-
Save kuyseng/2792096 to your computer and use it in GitHub Desktop.
javascript: indesign join string page number with symbol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function join_page_string (pages, symbol_first, symbol_last) { | |
| var page_string = ""; | |
| if( pages.length === 1 ) { return pages.toString();} | |
| for (var i = 0, len = pages.length; i < len; i++) { | |
| if(i < len-1) { | |
| page_string += pages[i]; | |
| if( i != len-2 ) { page_string += symbol_first} | |
| }else { | |
| page_string += (symbol_last + pages[i]); | |
| }; | |
| }; | |
| return page_string; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment