All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.robolectric.res.StringResources Maven / Gradle / Ivy

There is a newer version: 3.4-rc2
Show newest version
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