Files
javademos/java11-features/output/08-string-methods-on-8.txt
T

34 lines
1.8 KiB
Plaintext

# trim vs strip on the same string, Java 8 has no strip(); the Java 8 compile of src/StringMethods.java:
$ javac src/StringMethods.java (1.8.0_504)
src/StringMethods.java:9: error: cannot find symbol
System.out.println("strip() length : " + padded.strip().length());
^
symbol: method strip()
location: variable padded of type String
src/StringMethods.java:10: error: cannot find symbol
System.out.println("isBlank(\" \") : " + " ".isBlank() + " isEmpty: " + " ".isEmpty());
^
symbol: method isBlank()
location: class String
src/StringMethods.java:11: error: cannot find symbol
System.out.println("lines() : " + "a\nb\r\nc".lines().collect(Collectors.toList()));
^
symbol: method lines()
location: class String
src/StringMethods.java:12: error: cannot find symbol
System.out.println("repeat(3) : " + "ab".repeat(3));
^
symbol: method repeat(int)
location: class String
src/StringMethods.java:13: error: cannot find symbol
System.out.println("stripLeading : [" + " x ".stripLeading() + "] stripTrailing: [" + " x ".stripTrailing() + "]");
^
symbol: method stripLeading()
location: class String
src/StringMethods.java:13: error: cannot find symbol
System.out.println("stripLeading : [" + " x ".stripLeading() + "] stripTrailing: [" + " x ".stripTrailing() + "]");
^
symbol: method stripTrailing()
location: class String
6 errors