remove trailing zeros in the string

Posted on 2009-05-19
Last Modified: 2012-08-14
     if pageNumber comes as null i am assigning as 1;Let's assume that fin value is 10;then final output is coming as 010_1;
      i want to remove trailing zeros from the final output.
      var      pageNumber=document.forms[0].pageNumber.value;
            if(pageNumber == 'null' || pageNumber =="")

                  var fin=10;

              addData += ((pageNumber-1)*10)+fin+"_"+pageNumber+",";

Question by:chaitu chaitu
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 14

Expert Comment

ID: 24428716
I don't see any trailing zeroes in your example. Did you mean leading zeroes?
LVL 20

Author Comment

by:chaitu chaitu
ID: 24428723
LVL 29

Accepted Solution

David H.H.Lee earned 500 total points
ID: 24428727
Something like this?
var s;
s=((pageNumber-1)*10)+fin+"_"+pageNumber+","; //"010_1"
var regZ;
addData += s;

Open in new window


Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Print Rhino Java Array in Javascript 1 32
I'm a Human captcha checkbox 13 39
arrays and buttons with user input 2 32
Table style position to the left 8 24
Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

761 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question