List of usage examples for java.lang String concat
public String concat(String str)
From source file:com.liferay.sync.engine.util.Encryptor.java
public static String encrypt(String value) throws Exception { if (value == null) { return ""; }// w w w . j a v a 2 s . co m SecretKey secretKey = new SecretKeySpec(_PASSWORD, _ALGORITHM); Cipher cipher = Cipher.getInstance(_ALGORITHM); cipher.init(Cipher.ENCRYPT_MODE, secretKey); String salt = getSalt(); String encryptedValue = value; for (int i = 0; i < _ITERATIONS; i++) { encryptedValue = salt.concat(encryptedValue); byte[] encryptedBytes = cipher.doFinal(encryptedValue.getBytes(_UTF8_CHARSET)); encryptedValue = Base64.encodeBase64String(encryptedBytes); } return encryptedValue; }
From source file:Main.java
/** * Validates and processes the given Url * @param url The given Url to process * @return Pre-process Url as string */ public static String cleanUrl(StringBuilder url) { //ensure that the urls are absolute Pattern pattern = Pattern.compile("^(https?://[^/]+)"); Matcher matcher = pattern.matcher(url); if (!matcher.find()) throw new IllegalArgumentException("Invalid Url format."); //get the http protocol match String protocol = matcher.group(1); //remove redundant forward slashes String query = url.substring(protocol.length()); query = query.replaceAll("//+", "/"); //return process url return protocol.concat(query); }
From source file:Main.java
public static String getDeviceId(ContentResolver contentResolver) { String androidId = System.getString(contentResolver, System.ANDROID_ID); String androidBase = "androidDeviceId_"; if (androidId == null) { // This happens when running in the Emulator final String emulatorId = "android-RunningAsTestingDeleteMe"; return emulatorId; }/* w w w . j a v a2 s .c om*/ String deviceId = androidBase.concat(androidId); return deviceId; }
From source file:Main.java
public static String stringByReplacingString(String source, String search, String replace, boolean replaceAll) { /**//from www .j a v a2s . c o m return ( null == source || null == search || 0 == search.length() ) ? source : replaceAll ? source.replaceAll( search , null == replace ) ? "" : replace ) : source.replaceFirst( search , null == replace ) ? "" : replace ); /*/ if (source == null) return null; if (search == null || search.length() == 0) return source; if (replace == null) replace = ""; String string = ""; int i, j, n, o; n = source.length(); o = search.length(); for (i = 0; i < n;) { if ((j = source.indexOf(search, i)) < 0) break; string = string.concat(source.substring(i, j)); string = string.concat(replace); i += j + o; if (!replaceAll) break; } if (i < n) string = string.concat(source.substring(i)); return string; /**/ }
From source file:br.usp.poli.lta.cereda.spa2run.Utils.java
public static String prettyPrintMetrics() { String result = ""; for (Metric m : instruments) { result = result.concat(String.format("%s: %1.2f ", m.getName(), calculations.get(m.getName()))); }//from w w w . j a v a 2 s . c o m return result.trim(); }
From source file:com.activecq.api.plugins.form.SuccessPlugin.java
/** * Returns a URL (no scheme) to the success landing page (String path) with * success message//from ww w.ja va 2 s. co m * * @param path * @param message * @return * @throws JSONException * @throws UnsupportedEncodingException */ public static String getRedirectPath(String path, String message) throws UnsupportedEncodingException { if (StringUtils.isBlank(message)) { return path; } else { message = StringEscapeUtils.escapeJavaScript(message); return path.concat("?").concat(ActiveForm.CQ_FORM_SUCCESS).concat("=").concat(message); } }
From source file:Main.java
/** * Modifies the file extension for a DRM Forward Lock file NOTE: This * function shouldn't be called if the file shouldn't be DRM converted *//* w w w.ja v a 2 s . com*/ public static String modifyDrmFwLockFileExtension(String filename) { if (filename != null) { int extensionIndex; extensionIndex = filename.lastIndexOf("."); if (extensionIndex != -1) { filename = filename.substring(0, extensionIndex); } filename = filename.concat(EXTENSION_INTERNAL_FWDL); } return filename; }
From source file:com.iti.request.NearbyService.java
public static List<Address> getNearby(String x, String y, String r, String type) throws IOException { String url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?v=3&location="; url = url.concat(x); url = url.concat("%2C"); url = url.concat(y);//from w ww. jav a 2s . c om url = url.concat("&radius="); url = url.concat(r); url = url.concat("&types="); url = url.concat(type); url = url.concat("&key=AIzaSyAmsScw_ynzyQf32_KSGjbGiej7VN2rL7g"); String result = httpGet(url); Object obj = JSONValue.parse(result.toString()); JSONObject jsonObj = (JSONObject) obj; JSONArray resultsArray = (JSONArray) jsonObj.get("results"); Iterator i = resultsArray.iterator(); ArrayList<Address> addresses = new ArrayList<Address>(); while (i.hasNext()) { JSONObject jsonResult = (JSONObject) i.next(); String name = (String) jsonResult.get("name"); String vicinity = (String) jsonResult.get("vicinity"); System.out.println(name); Address address = new Address(); address.setName(name); address.setVicinity(vicinity); addresses.add(address); } return addresses; }
From source file:de.fhg.iais.asc.sipmaker.SipMakerKey.java
public static SipMakerKey fromTrunk(String metadataFormat, List<String> subFormats) { if (StringUtils.isEmpty(metadataFormat)) { throw new IllegalArgumentException("Metadata format may not be empty"); }/*from w w w .ja v a2 s . com*/ String current = metadataFormat; List<String> result = new ArrayList<String>(); result.add(current); for (String dir : subFormats) { if (!StringUtils.isEmpty(dir)) { current = current.concat(File.separator).concat(dir); result.add(current); } } Collections.reverse(result); result = Collections.unmodifiableList(result); return new SipMakerKey(result, ""); }
From source file:hydrograph.ui.common.util.PathUtility.java
private static String getFilePath(String defaultExtension, String finalParamPath, String[] fileExtensions) { if (!checkEndsWith(finalParamPath, fileExtensions)) { return finalParamPath.concat(defaultExtension); } else {/*w ww. j a v a 2 s .co m*/ return finalParamPath; } }