Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        String content = " <2008-10-07> hi <test>" + "   <2008-11-26>  user <test>" + "   <2008-11-28><aaaa>  ";
        Scanner sc = new Scanner(content).useDelimiter("\\s*[<>]\\s*");
        while (sc.hasNext()) {
            System.out.printf("[%s|%s|%s]%n", sc.next(), sc.next(), sc.next());
            if (sc.hasNext())
                sc.next();
        }
    }
}