dshrenik
asked on
javascript - split strings
I want to split a string according to this example:
"a|b||c||d|e"
into
"a"
"b"
""
"c"
""
"d"
"e"
If possible, please provide some sample code. Thanks!
"a|b||c||d|e"
into
"a"
"b"
""
"c"
""
"d"
"e"
If possible, please provide some sample code. Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Use split function
.split("|");
<script type="text/javascript">
var str="a|b||c||d|e";
document.write(str.split("
</script>
It will give you an string array.
/peter