有没有办法缩写(或定义自定义符号)白话命令,如Check
,Notation
, class Solution {
String[] strsa={"fsd","fds","fgsdgf","fggdgdgd"};
String prefix=longestCommonPrefix(strsa);
public String longestCommonPrefix(String[] strs) {
if (strs == null || strs.length == 0) {
return "";
}
String result = strs[0];
for (int i = 1; i < strs.length; i++) {
while (strs[i].indexOf(result) != 0) {
result = result.substring(0, result.length() - 1);
}
}
return result;
}
}
......?