List of usage examples for org.apache.commons.lang StringUtils stripEnd
public static String stripEnd(String str, String stripChars)
Strips any of a set of characters from the end of a String.
From source file:com.vmware.thinapp.common.converter.client.ProjectClient.java
public ProjectClient(String baseUrl) { // Strip to prevent URLs like /projects//5 that won't work. this.baseUrl = StringUtils.stripEnd(baseUrl, "/"); }
From source file:net.ripe.rpki.commons.crypto.util.KeyPairUtil.java
/** * Get Base64 encoded public key as string. Primarily for generating * filenames and transferring public keys across the wire.. Not fit for * decoding: strips the trailing '=' characters! */// w w w. j av a2 s .c o m public static String getEncodedKeyIdentifier(PublicKey key) { String encoded = base64UrlEncode(getKeyIdentifier(key)); return StringUtils.stripEnd(encoded, "="); // No need to decode, so we can strip padding. }
From source file:gaffer.example.util.JavaSourceUtil.java
public static String getRawJavaSnippet(final Class<?> clazz, final String modulePath, final String marker, final String start, final String end) { String javaCode = getRawJava(clazz.getName(), modulePath); final int markerIndex = javaCode.indexOf(marker); if (markerIndex > -1) { javaCode = javaCode.substring(markerIndex); javaCode = javaCode.substring(javaCode.indexOf(start) + start.length()); javaCode = javaCode.substring(0, javaCode.indexOf(end)); javaCode = StringUtils.stripEnd(javaCode, " " + String.format("%n")); } else {//from w w w .j a va 2s. c o m javaCode = ""; } return javaCode; }
From source file:com.dinochiesa.edgecallouts.util.CalloutUtil.java
/** * Strips all leading and trailing characters from the given string. * Does NOT strip characters in the middle, and strips the leading and * trailing characters respectively.//from w w w . j a va2 s .c om * e.g. "{abc}", "{", "}" returns "abc" * e.g. "aabccxyz", "ba", "z" returns "ccxy" * * @param toStrip The String to remove characters from * @param start The characters to remove from the start (in any order) * @param end The characters to remove from the end (in any order) * @return String with leading and trailing characters stripped */ public static String stripStartAndEnd(String toStrip, String start, String end) { if (StringUtils.isBlank(toStrip)) { throw new IllegalArgumentException("toStrip must not be blank or null"); } return StringUtils.stripEnd(StringUtils.stripStart(toStrip, start), end); }
From source file:com.intellij.react.css.modules.psi.CssModulesIndexedStylesVarPsiReferenceContributor.java
@Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(CssModulesUtil.STRING_PATTERN, new PsiReferenceProvider() { @NotNull//w ww .jav a2 s . c om @Override public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) { final PsiElement cssClassNamesImportOrRequire = CssModulesUtil .getCssClassNamesImportOrRequireDeclaration((JSLiteralExpression) element); if (cssClassNamesImportOrRequire != null) { final String literalClass = "." + StringUtils.stripStart(StringUtils.stripEnd(element.getText(), "\"'"), "\"'"); final Ref<StylesheetFile> referencedStyleSheet = new Ref<>(); final CssClass cssClass = CssModulesUtil.getCssClass(cssClassNamesImportOrRequire, literalClass, referencedStyleSheet); if (cssClass != null) { return new PsiReference[] { new PsiReferenceBase<PsiElement>(element) { @Nullable @Override public PsiElement resolve() { return cssClass; } @NotNull @Override public Object[] getVariants() { return new Object[0]; } } }; } else { if (referencedStyleSheet.get() != null) { final TextRange rangeInElement = TextRange.from(1, element.getTextLength() - 2); // minus string quotes return new PsiReference[] { new CssModulesUnknownClassPsiReference(element, rangeInElement, referencedStyleSheet.get()) }; } } } return new PsiReference[0]; } }); }
From source file:eu.europeana.corelib.web.model.PageData.java
public String getPortalServerSlashless() { return StringUtils.stripEnd(portalServer, "/"); }
From source file:com.squid.core.jdbc.vendor.redshift.postgresql.PostgresqlJDBCDataFormatter.java
@Override public Object unboxJDBCObject(final Object column, final int colType) throws SQLException { if (colType == Types.CHAR && column != null) { return StringUtils.stripEnd((String) column, " "); }//from w ww . j a v a 2s .com return column; }
From source file:com.squid.core.jdbc.vendor.greenplum.postgresql.PostgresqlJDBCDataFormatter.java
@Override public Object unboxJDBCObject(final Object column, final int colType) throws SQLException { if (colType == Types.CHAR && column != null) { return StringUtils.stripEnd((String) column, " "); } else if (column instanceof PGInterval) { return column.toString(); } else if (column instanceof PGobject) { return column.toString(); //} else if (column instanceof java.sql.Date) { // return new Date(((java.sql.Date)column).getTime()); }/* w ww .j a v a2 s . com*/ return column; }
From source file:com.squid.core.jdbc.vendor.sqlserver.SQLServerJDBCDataFormatter.java
@Override public Object unboxJDBCObject(final Object column, final int colType) throws SQLException { switch (colType) { case 1:// CHAR if (column != null) { return StringUtils.stripEnd((String) column, " "); } else {/* w w w . ja va 2 s .c om*/ return null; } case -9: //NVARCHAR case -15: //NCHAR if (column == null) { return null; } else { return column.toString(); } case Types.BIT: if (column instanceof Boolean && column != null) { if (((Boolean) column).booleanValue() == true) { return 1; } else { return 0; } } if (column != null) { return column.toString(); } else { return null; } } return column; }
From source file:com.google.resting.component.impl.URLContext.java
private void removeEnd() { this.contextPath = StringUtils.stripEnd(contextPath, ALL_SEPARATORS); }