/** * Check if the passed filename is a minified CSS filename * * @param sFilename * The filename to check. * @return <code>true</code> if the passed filename is a minified CSS * filename. */ public static boolean isMinifiedCSSFilename (@Nullable final String sFilename) { return StringHelper.endsWith (sFilename, CCSS.FILE_EXTENSION_MIN_CSS); }
/** * Check if the passed filename is a CSS filename (independent if regular or * minified) * * @param sFilename * The filename to check. * @return <code>true</code> if the passed filename is a CSS filename. */ public static boolean isCSSFilename (@Nullable final String sFilename) { return StringHelper.endsWith (sFilename, CCSS.FILE_EXTENSION_CSS); }
/** * Check if the passed filename is a CSS filename (independent if regular or * minified) * * @param sFilename * The filename to check. * @return <code>true</code> if the passed filename is a CSS filename. */ public static boolean isCSSFilename (@Nullable final String sFilename) { return StringHelper.endsWith (sFilename, CCSS.FILE_EXTENSION_CSS); }
/** * Check if the passed filename is a minified CSS filename * * @param sFilename * The filename to check. * @return <code>true</code> if the passed filename is a minified CSS * filename. */ public static boolean isMinifiedCSSFilename (@Nullable final String sFilename) { return StringHelper.endsWith (sFilename, CCSS.FILE_EXTENSION_MIN_CSS); }
public static boolean isJSFilename (@Nullable final String sFilename) { return StringHelper.endsWith (sFilename, CJS.FILE_EXTENSION_JS); }
public static boolean isMinifiedJSFilename (@Nullable final String sFilename) { return StringHelper.endsWith (sFilename, CJS.FILE_EXTENSION_MIN_JS); }
/** * Trim the passed tail from the source value. If the source value does not * end with the passed tail, nothing happens. * * @param sSrc * The input source string * @param sTail * The string to be trimmed of the end * @return The trimmed string, or the original input string, if the tail was * not found * @see #trimStart(String, String) * @see #trimStartAndEnd(String, String) * @see #trimStartAndEnd(String, String, String) */ @Nullable @CheckReturnValue public static String trimEnd (@Nullable final String sSrc, @Nullable final String sTail) { return endsWith (sSrc, sTail) ? sSrc.substring (0, sSrc.length () - sTail.length ()) : sSrc; }
@Nonnull public static String getTextWithState (@Nonnull final String sText, @Nonnull final ELabelType eType) { ValueEnforcer.notNull (sText, "Text"); ValueEnforcer.notNull (eType, "Type"); // Trim optional trailing colon String sPlainText = StringHelper.trimEnd (sText.trim (), LABEL_END); // Append suffix only, if at least some text is present if (StringHelper.hasText (sPlainText)) sPlainText += getSuffix (eType, !StringHelper.endsWith (sPlainText, '?')); return sPlainText; }
/** * Concatenate a base URL and a sub path incl. the path cleansing. More or * less the same as calling <code>getCleanPath (sURL + sPath)</code> * * @param sURL * The base URL. May not be <code>null</code>. * @param sPath * The path to append. May not be <code>null</code>. * @return The combined, cleaned path. * @see #getCleanPath(String) */ @Nonnull public static String getCleanConcatenatedUrlPath (@Nonnull final String sURL, @Nonnull final String sPath) { ValueEnforcer.notNull (sURL, "URL"); ValueEnforcer.notNull (sPath, "Path"); // If nothing is to be appended, just clean the base URL if (StringHelper.hasNoText (sPath)) return getCleanPath (sURL); final String sRealURL = StringHelper.endsWith (sURL, '/') ? sURL : sURL + '/'; final String sRealPath = StringHelper.startsWith (sPath, '/') ? sPath.substring (1) : sPath; return getCleanPath (sRealURL + sRealPath); }
if (StringHelper.startsWith (sOrigValue, '[') && StringHelper.endsWith (sOrigValue, ']'))
@Nonnull public static <T extends IHCNodeWithChildren <?>> T getNodeWithState (@Nonnull final T aNode, @Nonnull final ELabelType eType) { ValueEnforcer.notNull (aNode, "Node"); ValueEnforcer.notNull (eType, "Type"); // Only append the suffix, if at least one text child is present if (HCUtils.recursiveContainsAtLeastOneTextNode (aNode)) { final String sPlainText = aNode.getPlainText (); if (sPlainText.length () > 0) { final String sSuffixString = getSuffixString (eType); if (StringHelper.hasText (sSuffixString) && StringHelper.endsWith (sPlainText, sSuffixString)) { // Append only colon aNode.addChild (LABEL_END); } else if (!StringHelper.endsWith (sPlainText, LABEL_END)) aNode.addChild (getSuffix (eType, true)); } } return aNode; } }