/** * Returns <jk>true</jk> if the specified character is a valid first character for a number. * * @param c The character to test. * @return <jk>true</jk> if the specified character is a valid first character for a number. */ public static boolean isFirstNumberChar(char c) { return firstNumberChars.contains(c); }
private static AsciiSet getEscapeSet(char c) { AsciiSet s = ESCAPE_SETS.get(c); if (s == null) { s = AsciiSet.create().chars(c, '\\').build(); ESCAPE_SETS.put(c, s); } return s; } static Map<Character,AsciiSet> ESCAPE_SETS = new ConcurrentHashMap<>();
/** * Create a new {@link AsciiSet} object with the contents of this builder. * * @return A new {link AsciiSet} object. */ public AsciiSet build() { return new AsciiSet(store); } }
checkSectionName(section); checkKeyName(key); if (modifiers != null && ! MOD_CHARS.containsOnly(modifiers)) throw new ConfigException("Invalid modifiers: {0}", modifiers); return applyChange(true, ConfigEvent.setEntry(section, key, value, modifiers, comment, preLines));
checkSectionName(section); checkKeyName(key); if (modifiers != null && ! MOD_CHARS.containsOnly(modifiers)) throw new ConfigException("Invalid modifiers: {0}", modifiers); return applyChange(true, ConfigEvent.setEntry(name, section, key, value, modifiers, comment, preLines));
/** * Returns <jk>true</jk> if the specified character is a valid first character for a number. * * @param c The character to test. * @return <jk>true</jk> if the specified character is a valid first character for a number. */ public static boolean isFirstNumberChar(char c) { return firstNumberChars.contains(c); }
private static AsciiSet getEscapeSet(char c) { AsciiSet s = ESCAPE_SETS.get(c); if (s == null) { s = AsciiSet.create().chars(c, '\\').build(); ESCAPE_SETS.put(c, s); } return s; } static Map<Character,AsciiSet> ESCAPE_SETS = new ConcurrentHashMap<>();
/** * Create a new {@link AsciiSet} object with the contents of this builder. * * @return A new {link AsciiSet} object. */ public AsciiSet build() { return new AsciiSet(store); } }
checkSectionName(section); checkKeyName(key); if (modifiers != null && ! MOD_CHARS.containsOnly(modifiers)) throw new ConfigException("Invalid modifiers: {0}", modifiers); return applyChange(true, ConfigEvent.setEntry(name, section, key, value, modifiers, comment, preLines));
/** * Returns <jk>true</jk> if the specified character is a valid first character for a number. * * @param c The character to test. * @return <jk>true</jk> if the specified character is a valid first character for a number. */ public static boolean isFirstNumberChar(char c) { return firstNumberChars.contains(c); }
private static AsciiSet getEscapeSet(char c) { AsciiSet s = ESCAPE_SETS.get(c); if (s == null) { s = AsciiSet.create().chars(c, '\\').build(); ESCAPE_SETS.put(c, s); } return s; } static Map<Character,AsciiSet> ESCAPE_SETS = new ConcurrentHashMap<>();
/** * Create a new {@link AsciiSet} object with the contents of this builder. * * @return A new {link AsciiSet} object. */ public AsciiSet build() { return new AsciiSet(store); } }
/** * Returns <jk>true</jk> if the specified string contains at least one character in this set. * * @param s The string to test. * @return <jk>true</jk> if the string is not null and contains at least one character in this set. */ public boolean contains(CharSequence s) { if (s == null) return false; for (int i = 0; i < s.length(); i++) if (contains(s.charAt(i))) return true; return false; }
@Test public void testUnescapeChars() throws Exception { AsciiSet escape = AsciiSet.create("\\,|"); assertNull(unEscapeChars(null, escape)); assertEquals("xxx", unEscapeChars("xxx", escape)); assertEquals("xxx", unEscapeChars("xxx", escape)); assertEquals("x,xx", unEscapeChars("x\\,xx", escape)); assertEquals("x\\xx", unEscapeChars("x\\xx", escape)); assertEquals("x\\,xx", unEscapeChars("x\\\\,xx", escape)); assertEquals("x\\,xx", unEscapeChars("x\\\\\\,xx", escape)); assertEquals("\\", unEscapeChars("\\", escape)); assertEquals(",", unEscapeChars("\\,", escape)); assertEquals("|", unEscapeChars("\\|", escape)); escape = AsciiSet.create(",|"); assertEquals("x\\\\xx", unEscapeChars("x\\\\xx", escape)); }
/** * Returns <jk>true</jk> if the specified string contains at least one character in this set. * * @param s The string to test. * @return <jk>true</jk> if the string is not null and contains at least one character in this set. */ public boolean contains(CharSequence s) { if (s == null) return false; for (int i = 0; i < s.length(); i++) if (contains(s.charAt(i))) return true; return false; }
/** * Returns <jk>true</jk> if the specified string contains at least one character in this set. * * @param s The string to test. * @return <jk>true</jk> if the string is not null and contains at least one character in this set. */ public boolean contains(CharSequence s) { if (s == null) return false; for (int i = 0; i < s.length(); i++) if (contains(s.charAt(i))) return true; return false; }
/** * Returns <jk>true</jk> if the specified string contains only characters in this set. * * @param s The string to test. * @return * <jk>true</jk> if the string contains only characters in this set. * <br>Nulls always return <jk>false</jk>. * <br>Blanks always return <jk>true</jk>. */ public boolean containsOnly(String s) { if (s == null) return false; for (int i = 0; i < s.length(); i++) if (! contains(s.charAt(i))) return false; return true; } }
/** * Returns <jk>true</jk> if the specified string contains only characters in this set. * * @param s The string to test. * @return * <jk>true</jk> if the string contains only characters in this set. * <br>Nulls always return <jk>false</jk>. * <br>Blanks always return <jk>true</jk>. */ public boolean containsOnly(String s) { if (s == null) return false; for (int i = 0; i < s.length(); i++) if (! contains(s.charAt(i))) return false; return true; } }
/** * Returns <jk>true</jk> if the specified string contains only characters in this set. * * @param s The string to test. * @return * <jk>true</jk> if the string contains only characters in this set. * <br>Nulls always return <jk>false</jk>. * <br>Blanks always return <jk>true</jk>. */ public boolean containsOnly(String s) { if (s == null) return false; for (int i = 0; i < s.length(); i++) if (! contains(s.charAt(i))) return false; return true; } }