/** * Clean provided string to remove chars that are not valid as file name. * @param projectKey e.g. my:file */ public static String cleanKeyForFilename(String projectKey) { String cleanKey = StringUtils.deleteWhitespace(projectKey); return StringUtils.replace(cleanKey, ":", "_"); }
className = StringUtils.deleteWhitespace(className); if (className == null) { return null;
private static byte[] hexToByte(String str) { String s = StringUtils.deleteWhitespace(str); int len = s.length(); byte[] data = new byte[len / 2]; for (int i = 0; i < len; i += 2) { data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i + 1), 16)); } return data; }
int hours = 0; int minutes = 0; String sanitizedText = StringUtils.deleteWhitespace(text); Pattern pattern = Pattern.compile("\\s*+(?:(\\d++)\\s*+" + DAY + ")?+\\s*+(?:(\\d++)\\s*+" + HOUR + ")?+\\s*+(?:(\\d++)\\s*+" + MINUTE + ")?+\\s*+"); Matcher matcher = pattern.matcher(text);
/** * Converts a class name to a JLS style class name. * * @param className the class name * @return the converted name */ private static String toCanonicalName(String className) { className = StringUtils.deleteWhitespace(className); if (className == null) { throw new NullArgumentException("className"); } else if (className.endsWith("[]")) { StrBuilder classNameBuffer = new StrBuilder(); while (className.endsWith("[]")) { className = className.substring(0, className.length() - 2); classNameBuffer.append("["); } String abbreviation = (String) abbreviationMap.get(className); if (abbreviation != null) { classNameBuffer.append(abbreviation); } else { classNameBuffer.append("L").append(className).append(";"); } className = classNameBuffer.toString(); } return className; }
if (!isLocal) { if (StringUtils.isNotBlank(context.getString(HOSTNAMES))) { serverAddresses = StringUtils.deleteWhitespace( context.getString(HOSTNAMES)).split(",");
private List<String> getServerUrls() { String serverUrls = serverUrlsField.getText(); if (StringUtils.isNotBlank(serverUrls)) { return Arrays.asList(StringUtils.split(StringUtils.deleteWhitespace(serverUrls), ",")); } return null; }
public static Set<String> listAllIps(String word, long limit) { word = StringUtils.deleteWhitespace(word); String[] sets = word.split(IP_SET_SEPARATOR); IpRangeSet contain = new IpRangeSet(); IpRangeSet exclude = new IpRangeSet(); for (String set : sets) { if (set.startsWith(IP_SET_INVERT_PREFIX)) { exclude.closed(set.substring(1)); } else { contain.closed(set); } } contain.remove(exclude); long size = contain.size(); if (size == 0) { throw new IllegalArgumentException(String.format("Invalid empty ipset [%s]", word)); } if (size > limit) { throw new IllegalArgumentException(String.format("ip range length[%d] is too large, must less than %d", size, limit)); } Set<String> results = new HashSet<>(); for (Range<Long> range : contain.rangeSet.asRanges()) { range = ContiguousSet.create(range, DiscreteDomain.longs()).range(); for (long i = range.lowerEndpoint(); i <= range.upperEndpoint() ; i++) { results.add(NetworkUtils.longToIpv4String(i)); } } return results; }
IpPort ipPort = NetUtils.parseIpPortFromURI(configCenter); String url = uriConst.REFRESH_ITEMS + "?dimensionsInfo=" + StringUtils.deleteWhitespace(URLEncoder.encode(serviceName, "UTF-8")); Map<String, String> headers = new HashMap<>(); headers.put("x-domain-name", tenantName);
try { encodeServiceName = URLEncoder.encode(StringUtils.deleteWhitespace(serviceName), StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { LOGGER.error("encode failed. Error message: {}", e.getMessage()); encodeServiceName = StringUtils.deleteWhitespace(serviceName);
public String removeSpaces(final String string) { return StringUtils.deleteWhitespace(string); } }
/** * Sets the stereotype name for the identifiers on the new classes. * * @param identifierStereotypes The identifierStereotypes to set. */ public void setIdentifierStereotypes(String identifierStereotypes) { this.identifierStereotypes = StringUtils.deleteWhitespace(identifierStereotypes); }
/** * Clean provided string to remove chars that are not valid as file name. * @param projectKey e.g. my:file */ public static String cleanKeyForFilename(String projectKey) { String cleanKey = StringUtils.deleteWhitespace(projectKey); return StringUtils.replace(cleanKey, ":", "_"); }
/** * Returns hash code for specified string after removing whitespaces. * * @param str string * @return hash code for specified string after removing whitespaces */ static int getHashCode(String str) { if (str == null) { return 0; } return StringUtils.deleteWhitespace(str).hashCode(); }
@Override public int scan(String line) { String lineWithoutWhitespaces = StringUtils.deleteWhitespace(line); int matchers = 0; for (String str : strs) { matchers += StringUtils.countMatches(lineWithoutWhitespaces, str); } return matchers; } }
@Override public int scan(String line) { String lineWithoutWhitespaces = StringUtils.deleteWhitespace(line); int matchers = 0; for (String str : strs) { matchers += StringUtils.countMatches(lineWithoutWhitespaces, str); } return matchers; } }
private MetricsInfo buildOpRecordMetricsInfo(Op op, User user) { return Interns.info("op=" + StringUtils.deleteWhitespace(op.getOpType()) + ".user=" + user.getUser() + ".count", "Total operations performed by user"); } }
private Collection<Report> generateAttributeReportsByMBean(Mbean mbean) { Collection<Report> reports = new ArrayList<>(); for (Attrib attrib : mbean.getAttribList()) { final String title = String.format("%s[%s]", mbean.getObjectname().toString() , attrib.getName()); final String reportId = StringUtils.deleteWhitespace(mbean.getName()) + "." + attrib.getAlias() + "." + ATTRIBUTEREPORT; Report report = new Report(reportId, title, title, "verticalLabel"); report.addGraph(new Graph(attrib.getAlias(), attrib.getName(), attrib.getAlias(), Colors.getNextColor(), Colors.getNextColor(), Colors.getNextColor())); reports.add(report); Colors.resetColor(); } return reports; }
private Collection<Report> generateAttributeReportsByMBean(Mbean mbean) { Collection<Report> reports = new ArrayList<>(); for (Attrib attrib : mbean.getAttribList()) { final String title = String.format("%s[%s]", mbean.getObjectname().toString() , attrib.getName()); final String reportId = StringUtils.deleteWhitespace(mbean.getName()) + "." + attrib.getAlias() + "." + ATTRIBUTEREPORT; Report report = new Report(reportId, title, title, "verticalLabel"); report.addGraph(new Graph(attrib.getAlias(), attrib.getName(), attrib.getAlias(), Colors.getNextColor(), Colors.getNextColor(), Colors.getNextColor())); reports.add(report); Colors.resetColor(); } return reports; }
private void validateRewritten(String content, Uri base, String expected) throws Exception { HttpResponseBuilder response = new HttpResponseBuilder().setHeader("Content-Type", "text/css"); response.setContent(content); HttpRequest request = new HttpRequest(base); rewriter.rewrite(request, response); assertEquals(StringUtils.deleteWhitespace(expected), StringUtils.deleteWhitespace(response.getContent())); }