Java Code Examples for com.helger.commons.string.StringHelper#getCharCount()
The following examples show how to use
com.helger.commons.string.StringHelper#getCharCount() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PDTFormatter.java From ph-commons with Apache License 2.0 | 5 votes |
public LocalizedDateFormatCache () { super (aCacheKey -> { String sPattern = getSourcePattern (aCacheKey); // Change "year of era" to "year" sPattern = StringHelper.replaceAll (sPattern, 'y', 'u'); if (false) if (aCacheKey.m_eMode == EDTFormatterMode.PARSE && StringHelper.getCharCount (sPattern, 'u') == 1) { // In Java 9, if CLDR mode is active, switch from a single "u" to // "uuuu" (for parsing) sPattern = StringHelper.replaceAll (sPattern, "u", "uuuu"); } if (aCacheKey.m_eMode == EDTFormatterMode.PARSE && "de".equals (aCacheKey.m_aLocale.getLanguage ()) && aCacheKey.m_eStyle == FormatStyle.MEDIUM) { // Change from 2 required fields to 1 sPattern = StringHelper.replaceAll (sPattern, "dd", "d"); sPattern = StringHelper.replaceAll (sPattern, "MM", "M"); sPattern = StringHelper.replaceAll (sPattern, "HH", "H"); sPattern = StringHelper.replaceAll (sPattern, "mm", "m"); sPattern = StringHelper.replaceAll (sPattern, "ss", "s"); } // And finally create the cached DateTimeFormatter // Default to strict - can be changed afterwards return DateTimeFormatterCache.getDateTimeFormatterStrict (sPattern); }, 1000, LocalizedDateFormatCache.class.getName ()); }
Example 2
Source File: FileSystemRecursiveIterator.java From ph-commons with Apache License 2.0 | 4 votes |
@Nonnegative private static int _getLevel (@Nonnull final File aFile) { return StringHelper.getCharCount (aFile.getAbsolutePath (), File.separatorChar); }