Java - String Split with “.” (dot)

package com.lopes.tests;

public class StringSplitWithDot {

    public static void main(String[] args) {

        // Get only 12345
        String number = "12345.00000";

        // Split with error
        String splitError = number.split(".")[0];
        System.out.println("splitNumber " + splitError);

        // Correct way to split by dot(.)
        // "." is a special character. You have to use "\\." to escape this character
        String splitCorrect = number.split("\\.")[0];
        System.out.println("splitNumber " + splitCorrect);

    }

}


Output of Correct way
splitNumber 12345

JSF 2.2 New Features in Context

Now that JSF 2.2 is complete, this session demonstrates the most important features in the context of a self-contained sample application.

The features covered include
 • HTML5-friendly markup
• Faces Flow
• Resource library contracts

You will learn how JSF is still relevant in today's enterprise software stack. Specifically, you will learn why you would want to upgrade to JSF 2.2 rather than opting for a different architecture entirely.

Powered by Blogger