@Nonnull private static String _fixFormatter (@Nonnull final String s) { String ret = s; ret = StringHelper.replaceAll (ret, 'y', 'Y'); ret = StringHelper.replaceAll (ret, 'd', 'D'); return ret; }
@Nullable public static String getEscapedString (@Nullable final String sUnescaped) { // Based on https://github.com/phax/as2-lib/pull/19 return StringHelper.replaceAll (sUnescaped, "$", "$$"); } }
/** * Create a clean property value applicable for an {@link ObjectName} property * value by replacing the special chars ":" and "," with "." and "//" with * "__". If the input value contains a blank, the quotes value is returned. * * @param sPropertyValue * The original property value. May not be <code>null</code>. * @return The modified property value applicable for {@link ObjectName}. * @see ObjectName#quote(String) */ @Nonnull public static String getCleanPropertyValue (@Nonnull final String sPropertyValue) { // If a blank is contained, simply quote it if (sPropertyValue.indexOf (' ') != -1) return ObjectName.quote (sPropertyValue); // ":" is prohibited // "," is the property separator // "//" is according to the specs reserved for future use String ret = sPropertyValue; ret = StringHelper.replaceAll (ret, ':', '.'); ret = StringHelper.replaceAll (ret, ',', '.'); ret = StringHelper.replaceAll (ret, "//", "__"); return ret; }
@Nonnull @Nonempty private static String _getAsRegEx (@Nonnull @Nonempty final String sPath) { String sPathToUse = sPath; if (sPathToUse.endsWith ("/*")) { // Special handling for trailing "/*" which means that a servlet // registered for "/test/*" can be found with the servlet path "/test". sPathToUse = sPath.substring (0, sPath.length () - 2); } // Convert wildcard to regex return StringHelper.replaceAll (sPathToUse, "*", ".*"); }
/** * Checks, whether the given file name is valid in the sense, that it doesn't * contain any NUL characters. If the file name is valid, it will be returned * without any modifications. Otherwise, an {@link InvalidFileNameException} * is raised. * * @param sFilename * The file name to check * @return Unmodified file name, if valid. * @throws InvalidFileNameException * The file name was found to be invalid. */ @Nullable public static String checkFileName (@Nullable final String sFilename) { if (sFilename != null && sFilename.indexOf ('\u0000') != -1) { throw new InvalidFileNameException (sFilename, "Invalid filename: " + StringHelper.replaceAll (sFilename, "\u0000", "\\0")); } return sFilename; } }
/** * Get a quoted string value. Every double quote (") is replaced to a * backslash and a double quote (\"). * * @param sValue * The source value. May not be <code>null</code>. * @return An opening double quote + the quoted string + a closing double * quote * @since 6.1.2 */ @Nonnull @Nonempty public static String getQuotedStringValue (@Nonnull final String sValue) { ValueEnforcer.notNull (sValue, "Value"); if (sValue.length () == 0) return "\"\""; return '"' + StringHelper.replaceAll (sValue, "\"", "\\\"") + '"'; }
public void put (@Nonnull final String sPath, @Nullable final Object aValue) { // replace everything just to have opening separators ("[") left and only // one closing separator ("]") at the end String sRealPath = StringHelper.replaceAll (sPath, s_sClose + s_sOpen, s_sOpen); // Remove the remaining trailing closing separator sRealPath = StringHelper.trimEnd (sRealPath, s_sClose); // Remove any remaining opening closing separator because this indicates and // invalid level (as e.g. in 'columns[0][]') sRealPath = StringHelper.trimEndRepeatedly (sRealPath, s_sOpen); // Start parsing _parseAndAddItem (m_aMap, sRealPath, aValue); }
sResult = StringHelper.replaceAll (sResult, aMatcher.group (), sBeautified);
@Nonnull public IJSPathProvider getInstance (@Nonnull @Nonempty final String sLanguage) { return ConstantJSPathProvider.createWithConditionalComment (StringHelper.replaceAll (m_aPP.getJSItemPathRegular (), "{0}", sLanguage), m_aPP.getConditionalComment ()); } }
@Nonnull public IJSPathProvider getInstance (@Nonnull @Nonempty final String sLanguage) { return ConstantJSPathProvider.createWithConditionalComment (StringHelper.replaceAll (m_aPP.getJSItemPathRegular (), "{0}", sLanguage), m_aPP.getConditionalComment ()); } }
@Nonnull public IJSPathProvider getInstance (@Nonnull @Nonempty final String sLanguage) { return ConstantJSPathProvider.createWithConditionalComment (StringHelper.replaceAll (m_aPP.getJSItemPathRegular (), "{0}", sLanguage), m_aPP.getConditionalComment ()); } }
sResult = StringHelper.replaceAll (sResult, aMatcher.group (), sBeautified);
@Nonnull public IJSPathProvider getInstance (@Nonnull @Nonempty final String sLanguage) { return ConstantJSPathProvider.createWithConditionalComment (StringHelper.replaceAll (m_aPP.getJSItemPathRegular (), "{0}", sLanguage), m_aPP.getConditionalComment ()); } }
if (sValue.length () > 0) sValue = StringHelper.replaceAll (sValue, "; ", ";\n"); aParts.addAll (StringHelper.getExploded ('\n', sValue));
final String sRealItemList = StringHelper.replaceAll (sItemList, EXTENSION_MACRO_WEB_DEFAULT, "js,css,png,jpg,jpeg,gif,eot,svg,ttf,woff,woff2,map");
StringHelper.replaceAll (sButtonText, "\"", "\\\"") + "\"; }"));
aRow.addCell (HCExtHelper.nl2brList (StringHelper.replaceAll (sValue, sPathSep, "\n")));
aRow.addCell (HCExtHelper.nl2brList (StringHelper.replaceAll (sValue, sPathSep, "\n")));
aRow.addCell (HCUtils.nl2brList (StringHelper.replaceAll (sValue, sPathSep, "\n")));