javardfn-triples

How do I parse the following format string?


I have data in following format

<foo bar> <property abc> <this foo bar> .

Now there are essentially 4 parts in this string: foo bar; property abc; this foo bar; and .. How do I tokenize the above string into these four parts?


Solution

  • String[] array = string.split("> ");
    
    for (int i = 0; i < array.length -1; i++){
        System.out.println(array[i] + ">");
    }
    System.out.println(array[array.length-1]);