Join: Difference between revisions
Jump to navigation
Jump to search
Add javascript snippet |
|||
Line 5: | Line 5: | ||
Join returns a string that is created by concatenating a list of strings with an optional delimit character. The required argument, ''stringarray'', is a one-dimensional array of strings. The optional argument, ''delimiter'', is a string expression whose first character is used to separate the strings joined from ''stringarray''; if no string is provided a space character (" ") is used by default. To concantenate with no delimiters, use an empty space ("") as the delimiter. | Join returns a string that is created by concatenating a list of strings with an optional delimit character. The required argument, ''stringarray'', is a one-dimensional array of strings. The optional argument, ''delimiter'', is a string expression whose first character is used to separate the strings joined from ''stringarray''; if no string is provided a space character (" ") is used by default. To concantenate with no delimiters, use an empty space ("") as the delimiter. | ||
== Example == | == Example (Basic) == | ||
<pre> | <pre> | ||
Line 15: | Line 15: | ||
Print Join(Words) & "!" | Print Join(Words) & "!" | ||
Print Join(Letters, "_") | Print Join(Letters, "_") | ||
</pre> | |||
== Example (JavaScript) == | |||
<pre> | |||
// Join Example | |||
/* Join concatenates strings */ | |||
var Words, Letters; | |||
Words = new Array("Hello", "World"); | |||
Letters = new Array("D", "a", "l", "l", "a","s"); | |||
NSB.Print(Words.join(" ")); | |||
NSB.Print(Letters.join("_")); | |||
</pre> | </pre> | ||
Revision as of 22:15, 27 May 2013
Join(stringarray[, delimiter])
Description
Join returns a string that is created by concatenating a list of strings with an optional delimit character. The required argument, stringarray, is a one-dimensional array of strings. The optional argument, delimiter, is a string expression whose first character is used to separate the strings joined from stringarray; if no string is provided a space character (" ") is used by default. To concantenate with no delimiters, use an empty space ("") as the delimiter.
Example (Basic)
Rem Join Example 'Join concatenates strings Dim Words, Letters Words = Array("Hello", "World") Letters = Array("D", "a", "l", "l", "a","s") Print Join(Words) & "!" Print Join(Letters, "_")
Example (JavaScript)
// Join Example /* Join concatenates strings */ var Words, Letters; Words = new Array("Hello", "World"); Letters = new Array("D", "a", "l", "l", "a","s"); NSB.Print(Words.join(" ")); NSB.Print(Letters.join("_"));
Output
Hello World! Dallas