trim and split java

Solutions on MaxInterview for trim and split java by the best coders in the world

showing results for - "trim and split java"
Ana Sofia
17 Oct 2020
1package com.zetcode;
2
3import java.util.Arrays;
4
5public class SplitStringTrimEx {
6
7    public static void main(String[] args) {
8
9        var input = " wood, falcon\t, sky, forest\n";
10
11        var output = input.trim().split("\\s*,\\s*");
12
13        Arrays.stream(output).forEach(System.out::println);
14    }
15}
16