Available Methods
- isBlank ( )
- isEmpty ( )
- isNotBlank ( )
- isNotEmpty ( )
- equals ( )
- join ( )
- EMPTY
- split ( )
- trimToNull ( )
- equalsIgnoreCase ( )
- contains ( )
- replace ( )
- trimToEmpty ( )
- isNumeric ( )
- capitalize ( )
- defaultString ( )
- startsWith ( )
- substringAfter ( )
- trim ( )
- isNoneBlank ( )
- containsIgnoreCase ( )
- substringBefore ( )
- substringAfterLast ( )
- removeEnd ( )
- repeat ( )
- leftPad ( )
- lowerCase ( )
- countMatches ( )
- substring ( )
- isNoneEmpty ( )
- endsWith ( )
- startsWithIgnoreCase ( )
- stripEnd ( )
- replaceEach ( )
- abbreviate ( )
- defaultIfBlank ( )
- splitByWholeSeparator ( )
- uncapitalize ( )
- strip ( )
- rightPad ( )
- substringBeforeLast ( )
- defaultIfEmpty ( )
- substringBetween ( )
- length ( )
- removeStart ( )
- remove ( )
- isAnyEmpty ( )
- replaceChars ( )
- indexOf ( )
- isAnyBlank ( )
- joinWith ( )
- containsAny ( )
- replaceOnce ( )
- endsWithIgnoreCase ( )
- splitByWholeSeparatorPreserveAllTokens ( )
- splitPreserveAllTokens ( )
- startsWithAny ( )
- deleteWhitespace ( )
- appendIfMissing ( )
- compare ( )
- normalizeSpace ( )
- stripStart ( )
- replaceAll ( )
- lastIndexOf ( )
- equalsAnyIgnoreCase ( )
- stripToNull ( )
- upperCase ( )
- splitByCharacterTypeCamelCase ( )
- left ( )
- reverse ( )
- isAlphanumeric ( )
- center ( )
- isAsciiPrintable ( )
- chomp ( )
- getLevenshteinDistance ( )
- indexOfIgnoreCase ( )
- chop ( )
- equalsAny ( )
- isAllLowerCase ( )
- ordinalIndexOf ( )
- replacePattern ( )
- removeEndIgnoreCase ( )
- containsNone ( )
- isAllBlank ( )
- truncate ( )
- isAllEmpty ( )
- difference ( )
- stripAll ( )
- right ( )
- stripAccents ( )
- containsWhitespace ( )
- endsWithAny ( )
- isWhitespace ( )
- removeStartIgnoreCase ( )
- replaceIgnoreCase ( )
- indexOfAnyBut ( )
- swapCase ( )
- substringsBetween ( )
- wrap ( )
- toCodePoints ( )
- wrapIfMissing ( )
- isAllUpperCase ( )
- isAlpha ( )
- reverseDelimited ( )
- toEncodedString ( )
- compareIgnoreCase ( )
- containsOnly ( )
- removeFirst ( )
Related Classes
- java.util.Arrays
- java.io.File
- java.util.Collections
- java.io.InputStream
- java.util.Date
- java.util.Iterator
- java.util.concurrent.TimeUnit
- java.util.regex.Pattern
- java.net.URL
- java.io.FileInputStream
- java.text.SimpleDateFormat
- java.util.Locale
- java.lang.reflect.Method
- java.util.regex.Matcher
- java.util.Properties
- java.util.UUID
- java.util.stream.Collectors
- java.util.LinkedHashMap
- java.util.Objects
- java.nio.charset.Charset
- java.net.URI
- java.util.Map.Entry
- java.nio.file.Files
- java.util.Optional
- java.nio.charset.StandardCharsets
Java Code Examples for org.apache.commons.lang3.StringUtils#toCodePoints()
The following examples show how to use
org.apache.commons.lang3.StringUtils#toCodePoints() .
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: SnowflakeIdWorker.java From match-trade with Apache License 2.0 | 5 votes |
private static Long getWorkId(){ try { String hostAddress = Inet4Address.getLocalHost().getHostAddress(); int[] ints = StringUtils.toCodePoints(hostAddress); int sums = 0; for(int b : ints){ sums += b; } return (long)(sums % 32); } catch (UnknownHostException e) { // 如果获取失败,则使用随机数备用 return RandomUtils.nextLong(0,31); } }
Example 2
Source File: SnowflakeIdWorker.java From match-trade with Apache License 2.0 | 5 votes |
private static Long getDataCenterId(){ int[] ints = StringUtils.toCodePoints(SystemUtils.getHostName()); int sums = 0; for (int i: ints) { sums += i; } return (long)(sums % 32); }
Example 3
Source File: SnowflakeIdWorker.java From match-trade with Apache License 2.0 | 5 votes |
private static Long getWorkId(){ try { String hostAddress = Inet4Address.getLocalHost().getHostAddress(); int[] ints = StringUtils.toCodePoints(hostAddress); int sums = 0; for(int b : ints){ sums += b; } return (long)(sums % 32); } catch (UnknownHostException e) { // 如果获取失败,则使用随机数备用 return RandomUtils.nextLong(0,31); } }
Example 4
Source File: SnowflakeIdWorker.java From match-trade with Apache License 2.0 | 5 votes |
private static Long getDataCenterId(){ int[] ints = StringUtils.toCodePoints(SystemUtils.getHostName()); int sums = 0; for (int i: ints) { sums += i; } return (long)(sums % 32); }
Example 5
Source File: KeyGenerator.java From snowalker-shardingjdbc-demo with Apache License 2.0 | 5 votes |
/** * 适配分布式环境,根据主机名生成id * 分布式环境下,如:Kubernates云环境下,集群内docker容器名是唯一的 * 通过 @See org.apache.commons.lang3.SystemUtils.getHostName()获取主机名 * @return */ private Long getIdFromHostName(){ //unicode code point int[] ints = StringUtils.toCodePoints(SystemUtils.getHostName()); int sums = 0; for (int i: ints) { sums += i; } return (long)(sums); }