2017  Kodetalk | Feedback | Privacy Policy | Terms | About

how to split a string using . operator

basically my string contains . and i want to split it and store it in array. but if i am trying to split it using below process i am not getting the expected result.

String[] splitString = "I want to split. Now what to do.".split(".");

After doing this its giving an array of all char present in this string.

package com.moe;

import java.util.regex.Pattern;

public class SplitString {
    public static void main(String[] args) {
        String[] output = "I want to split. Now what to do.".split(Pattern.quote("."));

Answer is