-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringMethod.java
More file actions
31 lines (22 loc) · 854 Bytes
/
Copy pathStringMethod.java
File metadata and controls
31 lines (22 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package java11;
import java.util.stream.Collectors;
public class StringMethod {
public static void main(String[] args) throws Exception {
System.out.println(" ".isBlank()); //true
String s = "Anupam";
System.out.println(s.isBlank()); //false
String s1 = "";
System.out.println(s1.isBlank()); //true
String str = "JD\nJD\nJD";
System.out.println(str);
System.out.println(str.lines().collect(Collectors.toList()));
String str1 = " JD ";
System.out.println(str1.strip());
System.out.println(str1.stripLeading());
System.out.println(str1.stripTrailing());
String str2 = " JD ";
System.out.println(str2.strip());
System.out.println(str2.stripLeading());
System.out.println(str2.stripTrailing());
}
}