|
@@ -6,6 +6,9 @@ import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
|
|
|
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
|
|
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
|
|
|
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
|
|
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
|
|
|
|
|
|
|
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
|
+import java.io.PrintStream;
|
|
|
import java.util.Random;
|
|
import java.util.Random;
|
|
|
import java.util.UUID;
|
|
import java.util.UUID;
|
|
|
|
|
|
|
@@ -93,6 +96,30 @@ public class StrFunc {
|
|
|
return str1.equals(str2);
|
|
return str1.equals(str2);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public static String getExceptionStr(Exception e) {
|
|
|
|
|
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
|
|
|
+ PrintStream ps = new PrintStream(out);
|
|
|
|
|
+ e.printStackTrace(ps);
|
|
|
|
|
+ String rs = out.toString();
|
|
|
|
|
+ ps.close();
|
|
|
|
|
+ try {
|
|
|
|
|
+ out.close();
|
|
|
|
|
+ } catch (IOException ioException) {
|
|
|
|
|
+ ioException.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+ return rs;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static void main(String[] args) {
|
|
|
|
|
+ try{
|
|
|
|
|
+ String a = null;
|
|
|
|
|
+ a.equals("");
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (Exception e) {
|
|
|
|
|
+ System.out.println(getExceptionStr(e));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public static String randomUUID() {
|
|
public static String randomUUID() {
|
|
|
return UUID.randomUUID().toString();
|
|
return UUID.randomUUID().toString();
|
|
|
}
|
|
}
|