Skip to content

Commit 61fe723

Browse files
committed
Update StringUtils.java
1 parent 35b488a commit 61fe723

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/main/java/io/github/intisy/utils/utils/StringUtils.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,18 @@ public static String censor(String key) {
2121
}
2222
return censored;
2323
}
24+
2425
public static String value(String value, String key) {
2526
int i = value.indexOf(key) + key.length();
2627
return value.substring(i, value.indexOf("\"\n", i));
2728
}
29+
2830
public static String replaceSpecialCharacters(String input, String replacement) {
2931
Pattern pattern = Pattern.compile("[^a-zA-Z0-9]");
3032
Matcher matcher = pattern.matcher(input);
3133
return matcher.replaceAll(replacement);
3234
}
35+
3336
public static String generateUniqueString(String input) {
3437
try {
3538
MessageDigest digest = MessageDigest.getInstance("SHA-256");
@@ -39,6 +42,7 @@ public static String generateUniqueString(String input) {
3942
throw new RuntimeException("SHA-256 algorithm not found", e);
4043
}
4144
}
45+
4246
public static List<String[]> parseData(List<String> inputData) {
4347
List<String[]> result = new ArrayList<>();
4448
for (String line : inputData) {
@@ -47,6 +51,7 @@ public static List<String[]> parseData(List<String> inputData) {
4751
}
4852
return result;
4953
}
54+
5055
public static String encrypt(String text, String key) {
5156
StringBuilder encrypted = new StringBuilder();
5257
for (int i = 0; i < text.length(); i++) {
@@ -62,6 +67,7 @@ public static String encrypt(String text, String key) {
6267
public static String decrypt(String encryptedText, String key) {
6368
return encrypt(encryptedText, key); // XOR encryption is its own decryption
6469
}
70+
6571
public static String encrypt(String password) {
6672
try {
6773
MessageDigest digest = MessageDigest.getInstance("SHA-256");
@@ -71,6 +77,7 @@ public static String encrypt(String password) {
7177
throw new RuntimeException(e);
7278
}
7379
}
80+
7481
public static List<String> splitString(String string) {
7582
List<String> result = new ArrayList<>();
7683
StringBuilder line = new StringBuilder();

0 commit comments

Comments
 (0)