📄 useageguides.java
字号:
package useageOfString;
public class UseageGuides {
//the instance of class String, if bulit, can't be changed any more.But StringButter's instance can
// s1 = "123"+45+678 is different from s2 = 123+45+"678" s2 is same with "168678"
//-----------------------------------------------------------------
// parse object to string, if obj == null, return "null", or call obj.toString()
//public static String str.valueOf(boolean b); all from java.lang.String
//public static String str.valueOf(char c);
//public static String str.valueOf(int i);
//public static String str.valueOf(long l);
//public static String str.valueOf(float f);
//public static String str.valueOf(double d);
//-----------------------------------------------------------------
// String compare
//public int str.compareTo(String anotherString) return this.charAt(k) - anotherString.charAt(k) k = 0,1,2
//public int str.length()
//public char str.charAt(int index) return the (index+1)th char, thus "THU".charAt(0) == 'T' "abc".compareTo("ABC") == 32
//public boolean str.equals(Object anobj) def if two string is the same, but not pointer to the same
//public boolean str.equalsIgnoreCase(String astr) ignore case
// == pointer to the same
//-----------------------------------------------------------------
// String to other obj, such as Integer, Boolean, Double
//false: Boolean.parseBoolean(null) Boolean.parseBoolean("false") Boolean.parseBoolean(null)("ABC")
//Integer.parseInt(String str)
//Double.parseDouble(String str)
//-----------------------------------------------------------------
//StringBuffer
//StringBuffer's method: public String strbuf.toString()
//new StringBuffer(str)
//-----------------------------------------------------------------
//string array: String [] s = {new String("abc"), new String("efg"), new String("justok")};
// String [] s = new String[3] ---- not new String(3)
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -