Support appid level flow control #212
This commit is contained in:
@@ -42,7 +42,7 @@ public class NetworkUtils {
|
||||
|
||||
private static String serverIp;
|
||||
|
||||
private static final String SERVER_IP = "SERVER_IP";
|
||||
private static final String SERVER_IP = "SERVER_IP";
|
||||
|
||||
public static String getServerIp() {
|
||||
try {
|
||||
|
||||
@@ -71,6 +71,28 @@ public abstract class Utils {
|
||||
b.append(k).append(c).append(v).append(separator);
|
||||
}
|
||||
|
||||
public static String extract(String str, char separator, int nx) {
|
||||
int begin = 0, end = 0, n = 0, ny = nx + 1, l = str.length();
|
||||
for (int i = 0; i < l; i++) {
|
||||
char c = str.charAt(i);
|
||||
if (c == separator) {
|
||||
n++;
|
||||
if (n == nx) {
|
||||
begin = i + 1;
|
||||
} else if (n == ny) {
|
||||
end = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (begin == 0) {
|
||||
return Constants.Symbol.EMPTY;
|
||||
} else if (end == 0) {
|
||||
end = l;
|
||||
}
|
||||
return str.substring(begin, end);
|
||||
}
|
||||
|
||||
public static String initials2lowerCase(String s) {
|
||||
if (StringUtils.isBlank(s)) {
|
||||
return s;
|
||||
|
||||
Reference in New Issue
Block a user