public boolean isValid (@Nullable final String sVATIN) { if (StringHelper.hasNoText (sVATIN)) return false; final String sRealVATIN = StringHelper.replaceAll (sVATIN, " ", "").toUpperCase (); return m_aPattern.matcher (sRealVATIN).matches (); }
@Nonnull @Nonempty private static String _createStringValue (@Nonnull final String sValue) { return '"' + StringHelper.replaceAll (sValue, "\"", "\\\"") + '"'; }
@Nonnull @Nonempty private static String _createStringValue (@Nonnull final String sValue) { return '"' + StringHelper.replaceAll (sValue, "\"", "\\\"") + '"'; }
/** * Perform all string replacements on the input string as defined by the * passed map. All replacements are done using * {@link #replaceAll(String,String,CharSequence)} which is ok. * * @param sInputString * The input string where the text should be replaced. May be * <code>null</code>. * @param aTransTable * The map with the replacements to execute. If <code>null</code> is * passed, the input string is not altered. * @return <code>null</code> if the input string was <code>null</code>. */ @Nullable public static String replaceMultiple (@Nullable final String sInputString, @Nullable final Map <String, String> aTransTable) { if (hasNoText (sInputString) || aTransTable == null || aTransTable.isEmpty ()) return sInputString; String sOutput = sInputString; for (final Entry <String, String> aEntry : aTransTable.entrySet ()) sOutput = replaceAll (sOutput, aEntry.getKey (), aEntry.getValue ()); return sOutput; }
/** * Same as {@link #replaceAll(String, String, CharSequence)} but allowing for * a <code>null</code> new-value, which is than interpreted as an empty string * instead. * * @param sInputString * The input string where the text should be replace. If this parameter * is <code>null</code> or empty, no replacement is done. * @param sSearchText * The string to be replaced. May neither be <code>null</code> nor * empty. * @param aReplacementText * The string with the replacement. May be <code>null</code> or empty. * @return The input string as is, if the input string is empty or if the * string to be replaced is not contained. */ public static String replaceAllSafe (@Nullable final String sInputString, @Nonnull final String sSearchText, @Nullable final CharSequence aReplacementText) { return replaceAll (sInputString, sSearchText, getNotNull (aReplacementText, "")); }
sOutput = replaceAll (sOutput, aSearchTexts[nIndex], aReplacementTexts[nIndex]); return sOutput;
@Nonnull private static JSPackage _createJSCode (final String sAccount, final boolean bAnonymizeIP, final boolean bEnhancedLinkAttribution, @Nullable final Locale aDisplayLocale, @Nullable final String sTrackingOptOutMessage) { if (StringHelper.hasNoText (sAccount)) { throw new IllegalArgumentException ("account is empty"); } String sCode = OPTOUT_CODE_TEMPLATE + ORIG_ANALYTICS_CODE_TEMPLATE; sCode = StringHelper.replaceAll (sCode, ACCOUNT_PLACEHOLDER, sAccount); sCode = StringHelper.replaceAll (sCode, MSG_OPT_OUT_PLACEHOLDER, getTrackingOptOutMessage (aDisplayLocale, sTrackingOptOutMessage)); final JSPackage aPkg = new JSPackage (); StringBuilder aOptions = new StringBuilder (); if (bAnonymizeIP) { aOptions.append ("ga('set', 'anonymizeIp', true);"); } sCode = StringHelper.replaceAll (sCode, OPTIONS_PLACEHOLDER, aOptions.toString ()); aPkg.add (new JSExprDirect (sCode)); return aPkg; }
sRet = replaceAll (sRet, sSearchText, sReplacementText); } while (!sLastLiteral.equals (sRet)); return sRet;
return replaceAll (sInputString, sSearchText.charAt (0), aReplacementText.charAt (0));
final String sNewRules = StringHelper.replaceAll (sRules, "<'.'<", "<' '<'.'<"); final RuleBasedCollator aNewCollator = new RuleBasedCollator (sNewRules); aNewCollator.setStrength (Collator.TERTIARY);
if (sValue.length () > 0) sValue = StringHelper.replaceAll (sValue, "; ", ";\n"); aParts.addAll (StringHelper.getExploded ('\n', sValue));
aRow.addCell (HCUtils.nl2brList (StringHelper.replaceAll (sValue, sPathSep, "\n")));