List of usage examples for java.lang String toString
public String toString()
From source file:org.shareok.data.plosdata.PlosUtil.java
public static String getPlosCitation(String html) { String citation = ""; Document doc = Jsoup.parse(html.toString()); Elements articleInfoDiv = doc.select("div[class=articleinfo]"); if (!articleInfoDiv.isEmpty()) { Element citationParagraph = articleInfoDiv.first().child(0); if (null != citationParagraph) { citation = citationParagraph.text().replace("Citation:", ""); //System.out.println("the citation = "+citation+"\n\n"); }//from w w w. ja va2 s . c o m } return citation; }
From source file:de.awtools.basic.AWTools.java
/** * Ersetzt die ${...} Platzhalter in einem String. Die Ersetzung werden * in einer Map gelagert. Die Schluessel repraesentieren die Platzhalter * im String. Die Ersetzungen sind die Werte der Schluessel in der * <code>placeholders</code> Map. * * @param string Der zu pruefende String. * @param placeholders Die Ersetzungen.//from www. j av a 2 s .c om * @return Der ueberarbeitete String. */ public static String replacePlaceholder(final String string, final Map<String, String> placeholders) { String result = string; String[] keys = StringUtils.substringsBetween(string, "${", "}"); if (keys != null) { for (String key : keys) { String value = placeholders.get(key); if (value != null) { String sb = "${" + key + "}"; result = StringUtils.replace(result, sb.toString(), value); } } } return result; }
From source file:org.shareok.data.plosdata.PlosUtil.java
/** * //from w ww . ja v a 2 s .c o m * @param html : The string of the web page source * @return author contribution statement */ public static String getAuthorContributions(String html) { String contributions = ""; Document doc = Jsoup.parse(html.toString()); Elements articleInfoDiv = doc.select("div[class=contributions]"); if (!articleInfoDiv.isEmpty()) { Element contributionsParagraph = articleInfoDiv.first().child(2); if (null != contributionsParagraph) { contributions = contributionsParagraph.text(); //System.out.println("the contributions = "+contributions+"\n\n");System.exit(0); } } return contributions; }
From source file:net.lshift.diffa.adapter.scanning.DigestBuilderTest.java
private static Map<String, String> createAttrMap(String bizDate, String ss) { Map<String, String> attrs = new HashMap<String, String>(); attrs.put("bizDate", bizDate.toString()); attrs.put("someString", ss); return attrs; }
From source file:ke.co.tawi.babblesms.server.utils.StringUtil.java
/** * Converts a {@link Map} into a String, for example for logging purposes * //from ww w. j ava2 s.co m * @param map * @return a String representation of a Map. */ public static String objMapToString(Map map) { StringBuilder stringBuilder = new StringBuilder(); for (Object key : map.keySet()) { if (stringBuilder.length() > 0) { stringBuilder.append("&"); } String value = map.get(key).toString(); stringBuilder.append(key.toString()); stringBuilder.append("="); stringBuilder.append(value.toString()); } return stringBuilder.toString(); }
From source file:Main.java
public static String formatXML(String unformatted) throws SAXException, IOException, TransformerException, ParserConfigurationException { if (unformatted == null) return null; // remove whitespaces between xml tags String unformattedNoWhiteSpaces = unformatted.toString().replaceAll(">[\\s]+<", "><"); // Instantiate transformer input Source xmlInput = new StreamSource(new StringReader(unformattedNoWhiteSpaces)); StreamResult xmlOutput = new StreamResult(new StringWriter()); // Configure transformer Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); transformer.transform(xmlInput, xmlOutput); String formatted = xmlOutput.getWriter().toString(); return formatted; }
From source file:com.phonty.improved.Contacts.java
private static String Parse(String response) { String value = ""; try {//from ww w . j a v a2 s .c o m JSONObject jsonObject = new JSONObject(response.toString()); value = jsonObject.getString("status"); } catch (Exception e) { e.printStackTrace(); } return value; }
From source file:edu.duke.cabig.c3pr.utils.StringUtils.java
public static String wildCard(String _name) { String trimmedName = _name.toString().trim(); if (trimmedName == null || trimmedName.equals("") || trimmedName.length() == 0) { return ""; } else if (trimmedName.length() > 0 && !trimmedName.endsWith("%")) { return trimmedName + "%"; } else {/*from w w w. ja v a2 s. co m*/ return trimmedName; } }
From source file:com.p5solutions.core.utils.NumberUtils.java
public static boolean isByte(String value) { if (isNatural(value)) { Long v = NumberUtils.valueOf(value.toString(), Long.class); if (v >= Byte.MIN_VALUE && v <= Byte.MAX_VALUE) { return true; }//w w w.j a v a2 s . c o m } return false; }
From source file:com.p5solutions.core.utils.NumberUtils.java
public static boolean isShort(String value) { if (isNatural(value)) { Long v = NumberUtils.valueOf(value.toString(), Long.class); if (v >= Short.MIN_VALUE && v <= Short.MAX_VALUE) { return true; }// ww w . ja va2s .c o m } return false; }