org.cryptomator.cryptofs.common.StringUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cryptofs Show documentation
Show all versions of cryptofs Show documentation
This library provides the Java filesystem provider used by Cryptomator.
package org.cryptomator.cryptofs.common;
/**
* Functions used from commons-lang
*/
public final class StringUtils {
private StringUtils() {}
/**
* Removes the suffix of a string, if the string ends with the suffix.
*
* @param str input string
* @param remove the suffix to match and remove
* @return a copy of {@code str} with the suffix removed, otherwise just {@code str}
*/
public static String removeEnd(String str, String remove) {
if (str == null || remove == null) {
return str;
}
if (str.endsWith(remove)) {
return str.substring(0, str.length() - remove.length());
} else {
return str;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy