final String dbNameLcase = dbName.toLowerCase(); final String tblNameLcase = tblName.toLowerCase(); final String catNameLcase = normalizeSpace(catName).toLowerCase();
tblName = tblName.toLowerCase(); dbName = dbName.toLowerCase(); catName = normalizeSpace(catName).toLowerCase(); partitions.navigableKeySet(); for (Object[] fields : sqlResult) {
private String normalizeString(String string){ if (string == null) { return string; } return StringUtils.normalizeSpace(string.toUpperCase()); }
/** * Converts a string to upper camel case using whitespace and underscores as word boundaries. * * @param text Text to convert. * @return Text as upper camel case. */ public static String toCamelCaseUpper(String text) { return text == null ? null : WordUtils.capitalizeFully(StringUtils.normalizeSpace(text.replace('_', ' '))).replace(" ", ""); }
/** * Normalizes the Strings in the TextPair. * This mainly deals with whitespace-issues. * Other normalizations can be included. * * @param str * @return */ private String normalize(String str){ str = StringUtils.trimToEmpty(str); str = StringUtils.normalizeSpace(str); // remove whitespace before punctuation. not using \p{Punct}, // because it includes to many special characters. str = str.replaceAll("\\s+(?=[.!,\\?;:])", ""); return str; }
public String getContent() { try { if (this.parameterMap.isEmpty()) { if (ArrayUtils.isEmpty(content)) content = IOUtils.toByteArray(delegate.getInputStream()); else content = IOUtils.toByteArray(new LoggingServletInputStream(content)); } else { content = getContentFromParameterMap(this.parameterMap); } String requestEncoding = delegate.getCharacterEncoding(); String normalizedContent = StringUtils.normalizeSpace(new String(content, requestEncoding != null ? requestEncoding : StandardCharsets.UTF_8.name())); return StringUtils.isBlank(normalizedContent) ? null : normalizedContent; } catch (IOException e) { throw new IllegalStateException(); } }
/** * Reads the doctype of the XML input file and sets the appropriate tagset * enum element from {@link Tagset}. * * @throws NavException * @throws DocTypeNotFoundException */ private void setTagset() throws NavException, DocTypeNotFoundException { for (int i = 0; i < vn.getTokenCount(); i++) { if (vn.getTokenType(i) == VTDNav.TOKEN_DTD_VAL) { String docType = StringUtils.normalizeSpace(vn.toString(i)).replaceAll("'", "\""); if (docType.contains("JATS-archivearticle1.dtd")) tagset = Tagset.JATS_1_0; else if (docType.contains("journalpublishing.dtd") || docType.contains("archivearticle.dtd")) tagset = Tagset.NLM_2_3; else if (docType.contains("journalpublishing3.dtd") || docType.contains("archivearticle3.dtd")) tagset = Tagset.NLM_3_0; else throw new IllegalArgumentException( "Unsupported document type in file " + nxmlFile.getAbsolutePath() + ": " + docType); return; } } throw new DocTypeNotFoundException("Could not find a doctype in file " + nxmlFile); }
private void assertEqualsIgnoreWhitespace(String expected, String real) { LOGGER.info("exp. query>\n{}\nreal query>\n{}", expected, real); String expNorm = StringUtils.normalizeSpace(expected); String realNorm = StringUtils.normalizeSpace(real); if (!expNorm.equals(realNorm)) { String m = "Generated query is not correct. Expected:\n" + expected + "\nActual:\n" + real + "\n\nNormalized versions:\n\n" + "Expected: " + expNorm + "\nActual: " + realNorm + "\n"; LOGGER.error("{}", m); throw new AssertionError(m); } }
/** * Overridden to strip extraneous whitespace from the page text to easier string matching. */ @Override public String getPageText() { Page page = getCurrentWindow().getEnclosedPage(); if (page instanceof HtmlPage) { return normalizeSpace(((HtmlPage) page).asText()); } else { return super.getPageText(); } }
plugin.getServer().dispatchCommand(plugin.getConsole(), "handles remind " + uuid.toString() + " " + StringUtils.normalizeSpace(removed.replaceAll("(?i)" + Pattern.quote("remind"), "").replaceAll("(?i)" + Pattern.quote("me to"), ""))); }, 1L); } else if (split.contains("say")) { plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { plugin.getServer().dispatchCommand(plugin.getConsole(), "handles say " + uuid.toString() + " " + StringUtils.normalizeSpace(removed.replaceAll("(?i)" + Pattern.quote("say"), ""))); }, 1L); } else if (split.contains("name") || split.contains("name?")) {