AndroidAPS/app/src/main/java/info/nightscout/androidaps/utils/StringUtils.java

32 lines
875 B
Java
Raw Normal View History

2019-02-26 20:38:27 +01:00
package info.nightscout.androidaps.utils;
2018-06-23 21:36:18 +02:00
2019-06-16 09:00:47 +02:00
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
2018-06-23 21:36:18 +02:00
/**
* class contains useful String functions
*/
public class StringUtils {
private StringUtils() {
// this constructor is private, since this class should not get instantiated
}
public static String removeSurroundingQuotes(String string) {
if (string.length() >= 2 && string.charAt(0) == '"'
&& string.charAt(string.length() - 1) == '"') {
string = string.substring(1, string.length() - 1);
}
return string;
}
2019-06-02 16:24:51 +02:00
public static boolean emptyString(final String str) {
return str == null || str.length() == 0;
}
2019-06-16 09:00:47 +02:00
public static String formatInsulin(double insulin) {
return String.format(MainApp.gs(R.string.formatinsulinunits), insulin);
}
2018-06-23 21:36:18 +02:00
}