
org.robolectric.res.StringResources Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of robolectric-resources Show documentation
Show all versions of robolectric-resources Show documentation
An alternative Android testing framework.
package org.robolectric.res;
public class StringResources {
/**
* Provides escaping of String resources as described
*
* here
*
* @param text Text to escape.
* @return Escaped text.
*/
public static String escape(String text) {
if (text.length() > 1 && text.charAt(0) == '"' && text.charAt(text.length() - 1) == '"') {
text = text.substring(1, text.length() - 1);
} else {
text = text.replaceAll("\\\\(['\"])", "$1");
}
return text;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy