Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Arrays;

public class Main {
    public static void main(String[] argv) throws Exception {
        String testStr = "This;:, is:;:;:;. a!:; test?";
        System.out.println("Original string: " + testStr);
        String[] result = testStr.split("[.,!?:;]+\\s*");
        System.out.print("Split on various punctuation: ");
        System.out.println(Arrays.toString(result));
    }
}
/*
Original string: This;:, is:;:;:;. a!:; test?
Split on various punctuation: [This, is, a, test]
*/