...

View Full Version : parsing string



esthera
01-19-2005, 08:21 AM
can someone help me .

If I have a var x=abccddd!dkjfkdjfkldjf
How can I parse all before teh ! in one variable and everything after the ! in another variable?

Brandoe85
01-19-2005, 08:48 AM
You can use split(); It will split the string on the '!' and load them into an array.


<script type="text/javascript">
var x = "abccddd!dkjfkdjfkldjf";
var a = x.split("!");
document.write("before '!' " + a[0] + " after '!' " + a[1]);
</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum