Concat a string at certain character

Posted on 2004-11-12
Last Modified: 2010-03-31
If I have a string for example "000000.0000" or

How would I pull any thing off two spots past the decimal

So the rersults would return

 "000000.00" or
Question by:894359
    LVL 92

    Expert Comment

    s = s.substring(0, s.indexOf(".")+3);

    Author Comment

    Is it possible to do something like this?
    Take the below:


    and do something like this:

    <%=getStatBookValue(keyname).substring(0, s.indexOf(".")+3)%>

    LVL 92

    Accepted Solution

    <%=getStatBookValue(keyname).substring(0, getStatBookValue(keyname).indexOf(".")+3)%>

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
    Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
    Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
    Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now