Skip to content

Commit f88e1b9

Browse files
authored
Create StringSplitEx.java
1 parent 29c36ef commit f88e1b9

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

strings/StringSplitEx.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.zetcode;
2+
3+
import java.util.Arrays;
4+
5+
public class StringSplitEx {
6+
7+
public static void main(String[] args) {
8+
9+
var phoneNumber = "202-555-0154";
10+
11+
String[] output = phoneNumber.split("-");
12+
13+
Arrays.stream(output).forEach(part -> System.out.println(part));
14+
}
15+
}

0 commit comments

Comments
 (0)