Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
56 lines (42 loc) · 1.24 KB

File metadata and controls

56 lines (42 loc) · 1.24 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package string;
import myutil.Log;
/**
* Created by yahier on 17/4/10.
*/
public class Core {
static final String TAG = "Core";
public static final void main(String[] args) {
//test1();
//testOX();
// String value = saveTwoDecimal(12.000);
// System.out.println("value:" + value);
//
// double a = 0.95;
// System.out.println("value:" + (int) a);
test333();
}
private static String saveTwoDecimal(double value) {
return String.format("%.1f", value);
}
private static void testOX() {
String value = Integer.toHexString(14);
System.out.println("value:" + value);
}
private static void test333(){
String s1 = "[\"storeCouponSelected\"]";
String s2 = s1.replace("\\","");
System.out.println("s2:"+s2);
}
/**
* 测试String地址
*/
static void test1() {
String s1 = "abc";
String s2 = "abc";
String s3 = new String("abc");
Log.e(TAG, (s1 == s2));//true
Log.e(TAG, (s1 == s3));//false
Log.e(TAG, (s1.intern() == s3.intern()));//true
//从结果分析,str1和str2引用了相同的地址,str3和str1指向的常量地址是一样的。
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.