Results 1 to 3 of 3

Thread: Dividing numbers

  1. #1
    Join Date
    Apr 2007
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Dividing numbers

    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?

  2. #2
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Check the following code.

    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

  3. #3
    Join Date
    Apr 2007
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Thank you,

    that did the trick!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •