null 与 空值
String str = null;
指str对象为空
str.length()
会抛出java.lang.NullPointerException
异常
空值指对象参数值为空,即str = null;
此时str.length() == 0
substring
substring(0,0)
会返回空字符串
spilt
The string "boo:and:foo"
, for example, yields the following results with these expressions:
Regex Result
: { "boo", "and", "foo" }
o { "b", "", ":and:f" }
会省略结尾处的空字符串
运算
char -> int
char c = '6';
int i = c - '0';
去掉String前的0
String s = "007";
int i = Integer.parseInt(s);