List of usage examples for java.lang String contains
public boolean contains(CharSequence s)
From source file:Main.java
/** * Gets the directory files list./* ww w . j av a 2s . co m*/ * * @param directory * the directory * @return the directory files list */ public static HashMap<String, File> getDirectoryFilesList(File directory) { final HashMap<String, File> directoryList = new HashMap<String, File>(); if (directory == null) { return directoryList; } if (!directory.exists()) { return directoryList; } if (directory.isDirectory()) { final String[] list = directory.list(); // Some JVMs return null for File.list() when the // directory is empty. if (list != null) { for (final String element : list) { final File entry = new File(directory, element); if (!entry.isDirectory()) { String name = entry.getName(); if (name.length() > 0 && name.contains(".")) { name = (String) name.subSequence(0, name.lastIndexOf('.')); directoryList.put(name, entry); } } } } } return directoryList; }
From source file:it.unibas.spicy.persistence.object.ClassUtility.java
public static String extractSimpleClassName(String className) { if (className.contains(DOT_REPLACEMENT)) { className = decodeClassName(className); }/*from w ww . j a v a 2s . c o m*/ String result = className.substring(className.lastIndexOf(".") + 1); return result; }
From source file:Main.java
private static void setCustomFont(TextView c) { Object tag = c.getTag();//from w w w . ja va 2s . c o m if (tag instanceof String) { final String tagString = (String) tag; if (tagString.contains(TAG_BOLD) && bold != null) { c.setTypeface(bold); return; } if (tagString.contains(TAG_CONDENSED) && condensed != null) { c.setTypeface(condensed); return; } if (tagString.contains(TAG_LIGHT) && light != null) { c.setTypeface(light); return; } } if (normal != null) { c.setTypeface(normal); } }
From source file:shiver.me.timbers.spring.security.JwtSpringSecurityAdaptor.java
private static void checkForJwtAnnotation(ApplicationContext parent) { for (String name : parent.getBeanDefinitionNames()) { if (name.contains(JwtSpringSecurityConfiguration.class.getName())) { throw new IllegalStateException( "The @EnableJwtAuthentication has already been applied so the JWT adaptor configuration is redundant."); }//from w ww .j a v a2 s . c o m } }
From source file:com.yyl.common.utils.excel.FileTools.java
/** * ??//from w w w . j av a 2 s . co m * @return */ public static String getSuffix(String fileName) { if (StringUtils.isBlank(fileName)) { return ""; } else if (fileName.contains(".")) { return fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()); } return ""; }
From source file:Main.java
public static String getImgUrl(String str, int type) { Log.i("ImageUrlHelper", "Str0:" + str); if (str.contains("src")) str = str.substring(str.indexOf("src"), str.length()); if (str.contains("http://")) str = str.substring(str.indexOf("http://"), str.length()); String format = ""; if (str.contains(".jpeg")) format = ".jpeg"; else if (str.contains(".png")) format = ".png"; else if (str.contains(".gif")) format = ".gif"; else if (str.contains(".jpg")) format = ".jpg"; else//from www . j a v a2 s.co m format = str.substring(str.length() - 4); switch (type) { case NEWS_IMG_URL: do { str = str.substring(0, str.lastIndexOf(format)); } while (str.lastIndexOf(format) > 1); if (str.contains("_100x100")) str = str.substring(0, str.length() - 8); str = str + format; if (str.contains("article/")) { str = "http://static.cnbetacdn.com/" + str.substring(str.indexOf("article/")); } break; case CONTENT_IMG_URL: str = str.substring(0, str.indexOf(format + "\"")); str = str + format; break; } ; return str; }
From source file:Main.java
public static int getLogoColorIndex(String room) { int index = 0; if (TextUtils.isEmpty(room)) { return index; }//from w w w.ja v a 2s . co m if (room.contains("201")) { index = 1; } else if (room.contains("202")) { index = 2; } else if (room.contains("203")) { index = 3; } else if (room.contains("204")) { index = 4; } else if (room.contains("205")) { index = 5; } return index; }
From source file:de.Keyle.MyPet.util.player.UUIDFetcher.java
private static UUID getUUID(String id) { if (id.contains("-")) { return UUID.fromString(id); }// ww w . ja v a 2 s.c om return UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-" + id.substring(16, 20) + "-" + id.substring(20, 32)); }
From source file:end2endtests.runner.ProcessRunner.java
private static String prettyFormatCommand(List<String> command) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < command.size(); i++) { if (i > 0) { sb.append(' '); }/*from ww w.j av a 2 s . c o m*/ String arg = command.get(i); if (arg.contains(" ") || arg.contains("\\")) { arg = '"' + arg + '"'; } sb.append(arg); } return sb.toString(); }
From source file:jmap2gml.ItemImage.java
private static HashMap<String, Image> readConfig() { HashMap<String, Image> out = new HashMap<>(); JSONTEXT = ""; Image img;// www.j av a 2s . c om Scanner scan; try { scan = new Scanner(new File("ImageItemConfig")); while (scan.hasNext()) { JSONTEXT += scan.nextLine(); } config = new JSONObject(JSONTEXT); for (String str : config.keySet()) { if (!str.contains("XOFFSET") && !str.contains("YOFFSET")) { img = (new ImageIcon(config.getString(str))).getImage(); out.put(str, img); } } } catch (Exception ex) { Logger.getLogger(ItemImage.class.getName()).log(Level.SEVERE, null, ex); } return out; }