PDA

View Full Version : Dividing numbers



marringi
04-29-2008, 11:32 AM
Hello

I have to numbers that are divided with "_" (ex. 32_33). What I need to do is to get rid off the later number and only print the first one without the "_".

Say in the document is written 32_33, I only need printed 32..

Any ideas?

codeexploiter
04-29-2008, 11:40 AM
Check the following code.


<script type="text/javascript">
var value = "32_34";
value = parseInt(value.split("_"));
document.write(value);
</script>

The line document.write is not necessary and can be changed to whatever operation you want to perform

marringi
04-29-2008, 03:29 PM
Thank you,

that did the trick!