@Test public void testRemoveAll_StringString() { assertNull(StringUtils.removeAll(null, "")); assertEquals("any", StringUtils.removeAll("any", null)); assertEquals("any", StringUtils.removeAll("any", "")); assertEquals("", StringUtils.removeAll("any", ".*")); assertEquals("", StringUtils.removeAll("any", ".+")); assertEquals("", StringUtils.removeAll("any", ".?")); assertEquals("A\nB", StringUtils.removeAll("A<__>\n<__>B", "<.*>")); assertEquals("AB", StringUtils.removeAll("A<__>\n<__>B", "(?s)<.*>")); assertEquals("ABC123", StringUtils.removeAll("ABCabc123abc", "[a-z]")); try { StringUtils.removeAll("any", "{badRegexSyntax}"); fail("StringUtils.removeAll expecting PatternSyntaxException"); } catch (final PatternSyntaxException ex) { // empty } }
@Override protected String handle(String input, String second) { return StringUtils.removeAll(input, second); }
private String removeOwningTypePackageNameIn(String value) { String owningTypePackageName = owningTypePackageName(); return owningTypePackageName.isEmpty() ? value : removeAll(value, packageNameRegex(owningTypePackageName)); }
String href = StringUtils.removeAll(remainingTokens[0], "\""); if (StringUtils.isBlank(href)) { break; String target = remainingTokens.length > 1 ? StringUtils.removeAll(remainingTokens[1], "\"") : ""; String alt = remainingTokens.length > 2 ? StringUtils.removeAll(remainingTokens[2], "\"") : ""; String relativeCoordinates = remainingTokens.length > 3 ? remainingTokens[3] : ""; relativeCoordinates = StringUtils.substringBetween(relativeCoordinates, "(", ")");
public static <T extends RuleEntity> List<T> normalize(List<T> list){ for (T t : list) { // Normalize creditor id t.setCreditorId(StringUtils.removeAll(t.getCreditorId(), StringUtils.EMPTY)); t.updateSearchIndex(); } return list; } }
public static <T extends RuleEntity> List<T> normalize(List<T> list){ for (T t : list) { // Normalize creditor id t.setCreditorId(StringUtils.removeAll(t.getCreditorId(), StringUtils.EMPTY)); t.updateSearchIndex(); } return list; } }
private void logRequest(FilterableRequestSpecification requestSpec) { StringBuilder builder = new StringBuilder("REQUEST:\n\n"); Map<String, String> queryParams = requestSpec.getQueryParams(); String multiPartParams = requestSpec.getMultiPartParams().toString().replaceAll("[\\[\\]]", EMPTY).replaceAll(", ", ","); String body = prettyRequest(requestSpec); createLog(builder, "METHOD", requestSpec.getMethod(), false); createLog(builder, "REQUEST URL", requestSpec.getURI(), false); createLog(builder, "HEADERS", requestSpec.getHeaders().toString(), true); if (queryParams.size() > 0) createLog(builder, "QUERY PARAMS", removeAll(queryParams.toString(), "\\{|}"), false); if (!multiPartParams.isEmpty()) createLog(builder, "MULTI PART FORM DATA PARAMS", Arrays.stream(multiPartParams.split(",")).collect(Collectors.joining("<br>")), true); if (body.length() > 0) createLog(builder, "BODY", body, true); scenarioWrite(builder.toString()); }
public String getClassNameWithOuterClass() { String typeDeclaration = getTypeDeclaration(type); return removeAll(typeDeclaration, packageNameRegex(getPackageName())); }
@Override public boolean isSupported(final Path workdir, final String name) { if(workdir.isRoot()) { // Empty argument if not known in validation if(StringUtils.isNotBlank(name)) { // Bucket names must be a minimum of 6 and a maximum of 50 characters long, and must be globally unique; // two different B2 accounts cannot have buckets with the name name. Bucket names can consist of: letters, // digits, and "-". Bucket names cannot start with "b2-"; these are reserved for internal Backblaze use. if(StringUtils.startsWith(name, "b2-")) { return false; } if(StringUtils.length(name) > 50) { return false; } if(StringUtils.length(name) < 6) { return false; } return StringUtils.isAlphanumeric(StringUtils.removeAll(name, "-")); } } return true; }
@Override public boolean isSupported(final Path workdir, final String name) { if(workdir.isRoot()) { // Empty argument if not known in validation if(StringUtils.isNotBlank(name)) { // Container names must be lowercase, between 3-63 characters long and must start with a letter or // number. Container names may contain only letters, numbers, and the dash (-) character. if(StringUtils.length(name) > 63) { return false; } if(StringUtils.length(name) < 3) { return false; } return StringUtils.isAlphanumeric(StringUtils.removeAll(name, "-")); } } return true; }
/** * return the simple element valueType name if element valueType belongs to given the package and the fully qualified element * valueType name otherwise. * * @return the simple element valueType name if element valueType belongs to given the package and the fully qualified element * valueType name otherwise. */ public String getElementTypeName() { String elementTypeName = null; if (valueType.isArray()) { elementTypeName = getTypeDeclaration(valueType.getComponentType()); } else if (valueType.isSubtypeOf(Iterable.class)) { TypeToken<?> componentType = valueType.resolveType(Iterable.class.getTypeParameters()[0]); elementTypeName = getTypeDeclaration(componentType); // remove any generic type boundaries elementTypeName = removeAll(elementTypeName, "\\? extends").trim(); } return removeOwningTypePackageNameIn(elementTypeName); }