List of usage examples for java.lang String startsWith
public boolean startsWith(String prefix)
From source file:Main.java
public static String smaliClassToJava(String className) { if (className.startsWith("[")) { return className.replaceAll("/", "\\."); }// www . jav a2 s.c o m String javaName = smaliPrimitiveToJavaName.get(className); if (null != javaName) { // e.g. "I" -> "int" return javaName; } if (className.equals("?")) { // Probably lazy and didn't determine type. // This will probably result in a Class.forName exception. return className; } // Java doesn't like Lcom/package/class;, it wants "com.package.class" return className.substring(1, className.length() - 1).replaceAll("/", "."); }
From source file:Main.java
/** * Get a list of all saved characters names. *//*w w w . j a v a2 s .co m*/ public static List<String> listCharacterFileNames(Context context) { List<String> names = new ArrayList<>(); for (String name : context.fileList()) { if (name.startsWith(CORE_PREFIX) || name.startsWith(FAE_PREFIX)) { names.add(name); } } return names; }
From source file:com.bellman.bible.service.format.osistohtml.strongs.StrongsUtil.java
public static String getStrongsProtocol(String ref) { if (ref.startsWith("H")) { return Constants.HEBREW_DEF_PROTOCOL; } else if (ref.startsWith("G")) { return Constants.GREEK_DEF_PROTOCOL; }/* w w w. jav a 2 s .c o m*/ return null; }
From source file:Main.java
public static String concat(String path1, String path2) { String result;/*w w w .ja v a2s .co m*/ if (path2.startsWith("/") && path1.endsWith("/")) result = path1 + path2.substring(1); else if (path2.startsWith("/") || path1.endsWith("/")) result = path1 + path2; else result = path1 + "/" + path2; int i; while ((i = result.indexOf("/./")) >= 0) result = result.substring(0, i) + result.substring(i + 2); while (result.startsWith("./")) result = result.substring(2); while (result.endsWith("/.")) result = result.substring(0, result.length() - 2); if (result.isEmpty()) result = "/"; return result; }
From source file:Main.java
public static String getSetMethod(Class<?> c, String prefix, String postfix) { StringWriter sw = new StringWriter(); if (prefix == null) prefix = ""; if (postfix == null) postfix = ""; Method[] ms = c.getDeclaredMethods(); if (ms != null && ms.length > 0) { for (Method m : ms) { String name = m.getName(); if (name.startsWith("set") && isPublicNoStatic(m.getModifiers())) { sw.append(prefix).append(name).append("(").append(postfix).append(");\r\n"); }/*from w ww . j a v a 2 s. c o m*/ } } return sw.toString(); }
From source file:Main.java
public static List<String> getDatabaseList(Context context) { String[] strDatabaseList = context.databaseList(); List<String> list = new ArrayList<>(); if (strDatabaseList != null) { for (String name : strDatabaseList) { if (name.startsWith(DATABASE_START) && name.endsWith(DATABASE_TYPE)) { list.add(name.substring(0, name.length() - DATABASE_TYPE.length())); }// w w w . ja va 2s .c om } } return list; }
From source file:hello.SwaggerConfiguration.java
/** @todo How to automate? */ private static boolean notManagement(final String path) { if (path.startsWith("/env/") || path.startsWith("/metrics/")) return false; return !asList("/", "/archaius", "/autoconfig", "/beans", "/configprops", "/dump", "/env", "/error", "/health", "/heartbeat", "/info", "/metrics", "/mappings", "/pause", "/refresh", "/resume", "/restart", "/shutdown", "/trace").contains(path); }
From source file:Main.java
/** * Convenience method to extract name from {@code @fooAttribute="blagh"} * style filter./*from w w w . ja va 2s.c o m*/ * * @param filter * @return */ private static String extractFilterName(String filter) { if (filter.startsWith("@")) { return filter.substring(1, filter.indexOf("=")); } else if (filter.startsWith(".")) { // means this element, so return null return null; } else { return filter.substring(0, filter.indexOf("=")); } }
From source file:Main.java
/** * Returns true if the content type string indicates textual content. Currently these are any Content-Types that start with one of the * following:/*from www . j ava2 s . c o m*/ * <pre> * text/ * application/x-javascript * application/javascript * application/json * application/xml * application/xhtml+xml * </pre> * * @param contentType contentType string to parse * @return true if the content type is textual */ public static boolean hasTextualContent(String contentType) { return contentType != null && (contentType.startsWith("text/") || contentType.startsWith("application/x-javascript") || contentType.startsWith("application/javascript") || contentType.startsWith("application/json") || contentType.startsWith("application/xml") || contentType.startsWith("application/xhtml+xml")); }
From source file:Main.java
/** * Given a value that should contain a single string or enum key, return the string. * @param rawValue/* www. ja va2 s . co m*/ * @return */ public static String decodeRawValueToSingleString(String rawValue) throws Exception { String[] values = getSingleValue(rawValue); // logger.debug("values[].length=" + values.length); String dataType = values[0]; if (dataType.startsWith("r")) dataType = dataType.substring(1); if ("c".equals(dataType) || "e".equals(dataType) || "k".equals(dataType)) return values[1].replace("~sep~", " "); throw new Exception( "Data type is not 'c' (character), 'e' (enum) or 'k' (string key), found '" + values[0] + "'"); }