-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathString011.java
More file actions
35 lines (28 loc) · 1.34 KB
/
Copy pathString011.java
File metadata and controls
35 lines (28 loc) · 1.34 KB
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
32
33
34
35
package strings;
/**
* Created by WERT on 09.01.2017.
*/
public class String011 {
public static void main(String[] args) {
// примеры создания строк класса StringBuffer
StringBuffer strBfr1 = new StringBuffer("Подстрочка");
System.out.println("substring(int) = " + strBfr1.substring(3));
System.out.println("substring(int, int) = " + strBfr1.substring(0, 3));
StringBuffer strBfr2 = new StringBuffer().appendCodePoint(128640);
strBfr2.append("---");
strBfr2.appendCodePoint(128648);
System.out.println("\nstrBfr2 = " + strBfr2.toString());
System.out.println("strBfr2.length() = " + strBfr2.length());
System.out.println("strBfr2.codePointCount() = "
+ strBfr2.codePointCount(0, strBfr2.length()));
System.out.println("\ncodePint at 5 = " + strBfr2.codePointAt(5));
System.out.println("codePint before 6 = "
+ Integer.toHexString(strBfr2.codePointBefore(6)));
System.out.println("codePint at 6 = "
+ Integer.toHexString(strBfr2.codePointAt(6)));
System.out.println("\nstrBfr2.capacity() = " + strBfr2.capacity());
strBfr2.trimToSize();
System.out.println("after trim");
System.out.println("strBfr2.capacity() = " + strBfr2.capacity());
}
}