mirror of
https://github.com/Coloryr/AllMusic.git
synced 2026-11-20 11:09:36 +00:00
move
This commit is contained in:
1 parent
3a3aa7263a
commit
17f7be3c78
204 files changed
+7370
-294
No files matched your search
@@ -0,0 +1,30 @@
|
||||
package coloryr.allmusic.core.utils;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class Function {
|
||||
public static boolean isInteger(String str) {
|
||||
Pattern pattern = Pattern.compile("^[-+]?[\\d]*$");
|
||||
return pattern.matcher(str).matches();
|
||||
}
|
||||
|
||||
public static String getString(String a, String b, String c) {
|
||||
int x = a.indexOf(b) + b.length();
|
||||
int y;
|
||||
if (c != null)
|
||||
y = a.indexOf(c);
|
||||
else y = a.length();
|
||||
if (x < 0 || y < 0)
|
||||
return a;
|
||||
return a.substring(x, y);
|
||||
}
|
||||
|
||||
public static int countChar(String a, char b) {
|
||||
int count = 0;
|
||||
for (char t : a.toCharArray()) {
|
||||
if (t == b)
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user