mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-25 19:15:16 +00:00
aacf50316d
Fixes #6847 // FREEBIE
22 lines
527 B
Java
22 lines
527 B
Java
package org.thoughtcrime.securesms.util;
|
|
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
public class DelimiterUtil {
|
|
|
|
public static String escape(String value, char delimiter) {
|
|
return value.replace("" + delimiter, "\\" + delimiter);
|
|
}
|
|
|
|
public static String unescape(String value, char delimiter) {
|
|
return value.replace("\\" + delimiter, "" + delimiter);
|
|
}
|
|
|
|
public static String[] split(String value, char delimiter) {
|
|
String regex = "(?<!\\\\)" + Pattern.quote(delimiter + "");
|
|
return value.split(regex);
|
|
}
|
|
|
|
}
|