JavaScript split() Method
Complete RegExp Object Reference
Definition and Usage
The split() method is used to split a string into an array of strings.
This method supports regular expressions.
Syntax
stringObject.split(spl,howmany)
|
Parameter |
Description |
spl |
Required. Specifies the character, regular expression, or
substring that is used to determine where to split the string |
howmany |
Optional. Specify how many times split should occur. Must
be a numeric value |
Tips and Notes
Note: If an empty string ("") is used as the separator, the string is
split between each character.
Example
In this example we will split up a string into an array, using a regular
expression to remove any non word characters:
<script type="text/javascript">
var str = "Peter Lois Chris Meg Stewie";
var pattern = /\W+/;
result = str.split(pattern);
document.write(result);
</script>
|
Try-It-Yourself Demos
split()
How to use split() to split up a string using a regular expression.
Complete RegExp Object Reference
Learn how your website performs under various load conditions
|
|
WAPT
is a load, stress and performance testing tool for websites and web-based applications.
In contrast to "800-pound gorilla" load testing tools, it is designed to minimize the learning
curve and give you an ability to create a heavy load from a regular workstation.
WAPT is able to generate up to 3000 simultaneously acting virtual users using standard hardware configuration.
Virtual users in each profile are fully customizable. Basic and NTLM authentication methods are supported.
Graphs and reports are shown in real-time at different levels of detail, thus helping to manage the testing process.
Download the free 30-day trial!
|
|