List of usage examples for java.lang String contains
public boolean contains(CharSequence s)
From source file:org.cloudfoundry.identity.uaa.user.UaaAuthority.java
public static UaaAuthority fromAuthorities(String authorities) { String type = authorities == null ? "uaa.user" : authorities.toLowerCase(); return type.contains("uaa.admin") ? UAA_ADMIN : UAA_USER; }
From source file:com.playonlinux.core.scripts.Script.java
public static Script.Type detectScriptType(String script) { final String firstLine = script.split("\n")[0]; if (firstLine.contains("#!/bin/bash") || firstLine.contains("#!/usr/bin/env playonlinux-bash")) { return Script.Type.LEGACY; } else {// w ww .ja v a 2s. c o m return Script.Type.RECENT; } }
From source file:de.micromata.genome.tpsb.executor.GroovyShellExecutor.java
private static String decode(String text) { if (text.contains("\n") == false) { return text; }/*from w ww .j a va2s.com*/ return "EOT<<\n" + text + "\n<<EOT"; }
From source file:Main.java
/** * Populate the given {@link TextView} with the requested text, formatting * through {@link Html#fromHtml(String)} when applicable. Also sets * {@link TextView#setMovementMethod} so inline links are handled. *///w ww. j av a 2s .c o m public static void setTextMaybeHtml(TextView view, String text) { if (TextUtils.isEmpty(text)) { view.setText(""); return; } if (text.contains("<") && text.contains(">")) { view.setText(Html.fromHtml(text)); view.setMovementMethod(LinkMovementMethod.getInstance()); } else { view.setText(text); } }
From source file:Main.java
/** * Applies the cm: default namespace to all the path-part on which the * namespace is missing.//from ww w . j a v a 2s. c om * * @param xpathValue * @return */ public static String getXPathEquivalentPath(String pathToResource) { final StringBuilder sb = new StringBuilder(); final String[] splitPath = pathToResource.split("/"); final Iterator<String> it = Arrays.asList(splitPath).iterator(); while (it.hasNext()) { final String pathElement = it.next(); if (pathElement.isEmpty()) continue; if (!pathElement.contains(":") && !pathElement.contains("{")) { // weak but sufficient in a first place sb.append("cm:"); } sb.append(pathElement); if (it.hasNext()) { sb.append("/"); } } return sb.toString(); }
From source file:Main.java
/** * Return the MIME type from the URI// ww w.j av a 2s. c om * @param context Context * @param uri URI * @return Return the MIME type */ public static String getMimetypeFromUri(Context context, Uri uri) { String contentType = context.getContentResolver().getType(uri); if (TextUtils.isEmpty(contentType)) { final MimeTypeMap type_map = MimeTypeMap.getSingleton(); // Get the extension from the path String extension = MimeTypeMap.getFileExtensionFromUrl(uri.toString()); extension = extension.toLowerCase(); if (extension.contains(".")) { extension = extension.substring(extension.lastIndexOf(".")); } contentType = type_map.getMimeTypeFromExtension(extension); } return contentType; }
From source file:Main.java
public static boolean hasMytext(String string, String mytext) { if (TextUtils.isEmpty(string) && TextUtils.isEmpty(mytext)) return false; else {// ww w.j a v a 2s . co m if (string.contains(mytext)) return true; else return false; } }
From source file:Main.java
private static final String addURIParamIfExists(String url, String key, String value) { if (url == null || url.equals("")) { return url; }/*from w w w . j a v a 2s.c o m*/ if (!url.contains("?")) { url += "?"; } if (!(url.endsWith("&") || url.endsWith("?"))) { url += "&"; } url += key + "=" + encodeURIComponent(value); return url; }
From source file:Main.java
public static String getSdCardPath(ContentResolver cr, Uri uri, String defaultPath) { ArrayList files = new ArrayList(); if (uri != null) { Cursor mCursor = cr.query(uri, null, null, null, null); if (mCursor != null) { while (mCursor.moveToNext()) { String path = mCursor.getString(mCursor.getColumnIndexOrThrow("_data")); if (!path.contains(defaultPath)) { String parentFolder = (new File(path)).getParent(); if (!files.contains(parentFolder)) { files.add(parentFolder); }// w w w. j a v a2s . c o m } } } } return getCommonSubStringFromList(files); }
From source file:cd.go.contrib.elasticagents.dockerswarm.elasticagent.DockerSecrets.java
private static Map<String, String> lineToMap(String content) { final String[] properties = content.split(","); final HashMap<String, String> map = new HashMap<>(); for (String property : properties) { if (property.contains("=")) { final String[] parts = property.split("=", 2); map.put(stripToEmpty(parts[0]).toLowerCase(), stripToEmpty(parts[1])); }//from w w w. j av a2 s . com } if (isBlank(map.get("src"))) { throw new RuntimeException( format("Invalid secret specification `{0}`. Must specify property `src` with value.", content)); } return map; }