Class CodepointHelper
java.lang.Object
com.helger.commons.text.codepoint.CodepointHelper
General utilities for dealing with Unicode characters
- Author:
- Apache Abdera
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic CodepointcodepointAt(CharSequence aSeq, int nIndex) static StringgetAsString(int nCodepoint) static chargetHighSurrogate(int nCodepoint) static intgetIndex(int[] aCodepointSet, int nValue) static chargetLowSurrogate(int nCodepoint) static booleaninRange(char[] aChars, char cLow, char cHigh) static booleaninRange(char[] aChars, int nLow, int nHigh) static booleaninRange(int nCodepoint, int nLow, int nHigh) static voidinsert(CharSequence aSeq, int nIndex, int nCodepoint) Insert a codepoint into the buffer, automatically dealing with surrogate pairsstatic voidinsert(CharSequence aSeq, int nIndex, Codepoint aCodepoint) Insert a codepoint into the buffer, automatically dealing with surrogate pairsstatic booleaninverseSetContains(int[] aCodepointSet, int value) Treats the specified int array as an Inversion Set and returnstrueif the value is located within the set.static booleanis_ifragment(int codepoint) static booleanis_ihost(int codepoint) static booleanis_ipath(int codepoint) static booleanis_ipathnodelims(int codepoint) static booleanis_ipchar(int codepoint) static booleanis_ipliteral(int codepoint) static booleanis_iprivate(int codepoint) static booleanis_iquery(int codepoint) static booleanis_iregname(int codepoint) static booleanis_iserver(int codepoint) static booleanis_iunreserved(int codepoint) static booleanis_iuserinfo(int codepoint) static booleanis_regname(int codepoint) static booleanis_ucschar(int codepoint) static booleanisBidi(int nCodepoint) static booleanisFragment(int codepoint) static booleanisGenDelim(int codepoint) static booleanisHex(int nCodepoint) static booleanisMark(int codepoint) static booleanisPath(int codepoint) static booleanisPathNoDelims(int codepoint) static booleanisPchar(int codepoint) static booleanisPctEnc(int codepoint) static booleanisQuery(int codepoint) static booleanisReserved(int codepoint) static booleanisScheme(int codepoint) static booleanisSubDelim(int codepoint) static booleanisUnreserved(int codepoint) static booleanisUserInfo(int codepoint) static intlength(char[] aArray) static intlength(AbstractCodepointIterator aIter) static intlength(CharSequence aSeq) static voidsetChar(CharSequence aSeq, int nIndex, int nCodepoint) Set the character at a given location, automatically dealing with surrogate pairsstatic voidsetChar(CharSequence aSeq, int nIndex, Codepoint aCodepoint) Set the character at a given location, automatically dealing with surrogate pairsstatic StringRemoves leading and trailing bidi controls from the stringstatic StringstripBidiInternal(String sStr) Removes bidi controls from within a stringstatic voidverify(char[] aArray, ECodepointProfile eProfile) Verifies a sequence of codepoints using the specified profilestatic voidverify(AbstractCodepointIterator aIter, ECodepointProfile eProfile) Verifies a sequence of codepoints using the specified filterstatic voidverify(AbstractCodepointIterator aIter, IntPredicate aFilter) Verifies a sequence of codepoints using the specified filterstatic voidverify(String sStr, ECodepointProfile eProfile) Verifies a sequence of codepoints using the specified profilestatic voidverifyNot(char[] aArray, ECodepointProfile eProfile) Verifies a sequence of codepoints using the specified profilestatic voidverifyNot(ICodepointIterator aIter, ECodepointProfile eProfile) Verifies a sequence of codepoints using the specified profilestatic voidverifyNot(ICodepointIterator aIter, IntPredicate aFilter) Verifies a sequence of codepoints using the specified filterstatic StringWrap the string with the specified bidi control
-
Field Details
-
LRE
public static final char LRE- See Also:
-
RLE
public static final char RLE- See Also:
-
LRO
public static final char LRO- See Also:
-
RLO
public static final char RLO- See Also:
-
LRM
public static final char LRM- See Also:
-
RLM
public static final char RLM- See Also:
-
PDF
public static final char PDF- See Also:
-
-
Method Details
-
inRange
- Parameters:
aChars- char arraycLow- Low indexcHigh- high index- Returns:
trueif all the characters in chars are within the set [low,high]
-
inRange
public static boolean inRange(char[] aChars, int nLow, int nHigh) - Parameters:
aChars- char arraynLow- Low indexnHigh- high index- Returns:
trueif all the characters in chars are within the set [low,high]
-
inRange
public static boolean inRange(int nCodepoint, int nLow, int nHigh) - Parameters:
nCodepoint- codepointnLow- Low indexnHigh- high index- Returns:
trueif the codepoint is within the set [low,high]
-
getHighSurrogate
public static char getHighSurrogate(int nCodepoint) - Parameters:
nCodepoint- Codepoint- Returns:
- Get the high surrogate for a particular unicode codepoint
-
getLowSurrogate
public static char getLowSurrogate(int nCodepoint) - Parameters:
nCodepoint- Codepoint- Returns:
- Get the low surrogate for a particular unicode codepoint
-
codepointAt
- Parameters:
aSeq- source sequencenIndex- index- Returns:
- the codepoint at the given location, automatically dealing with surrogate pairs
-
insert
Insert a codepoint into the buffer, automatically dealing with surrogate pairs- Parameters:
aSeq- source sequencenIndex- indexaCodepoint- codepoint to be inserted
-
insert
Insert a codepoint into the buffer, automatically dealing with surrogate pairs- Parameters:
aSeq- source sequencenIndex- indexnCodepoint- codepoint to be inserted
-
setChar
Set the character at a given location, automatically dealing with surrogate pairs- Parameters:
aSeq- source sequencenIndex- indexaCodepoint- codepoint to be set
-
setChar
Set the character at a given location, automatically dealing with surrogate pairs- Parameters:
aSeq- source sequencenIndex- indexnCodepoint- codepoint to be set
-
length
- Parameters:
aSeq- source sequence- Returns:
- the total number of codepoints in the buffer. Each surrogate pair counts as a single codepoint
-
length
- Parameters:
aArray- source array- Returns:
- the total number of codepoints in the buffer. Each surrogate pair counts as a single codepoint
-
length
-
getAsString
- Parameters:
nCodepoint- codepoint- Returns:
- the String representation of the codepoint, automatically dealing with surrogate pairs
-
stripBidi
Removes leading and trailing bidi controls from the string- Parameters:
sStr- Source string- Returns:
- the modified string
-
stripBidiInternal
Removes bidi controls from within a string- Parameters:
sStr- Source string- Returns:
- the modified string
-
wrapBidi
Wrap the string with the specified bidi control- Parameters:
sStr- source stringcChar- source char- Returns:
- The wrapped string
-
isHex
public static boolean isHex(int nCodepoint) -
isBidi
public static boolean isBidi(int nCodepoint) - Parameters:
nCodepoint- codepoint- Returns:
trueif the codepoint is a bidi control character
-
getIndex
-
inverseSetContains
Treats the specified int array as an Inversion Set and returnstrueif the value is located within the set. This will only work correctly if the values in the int array are monotonically increasing- Parameters:
aCodepointSet- Source setvalue- Value to check- Returns:
trueif the value is located within the set
-
isPctEnc
public static boolean isPctEnc(int codepoint) -
isMark
public static boolean isMark(int codepoint) -
isUnreserved
public static boolean isUnreserved(int codepoint) -
isReserved
public static boolean isReserved(int codepoint) -
isGenDelim
public static boolean isGenDelim(int codepoint) -
isSubDelim
public static boolean isSubDelim(int codepoint) -
isPchar
public static boolean isPchar(int codepoint) -
isPath
public static boolean isPath(int codepoint) -
isPathNoDelims
public static boolean isPathNoDelims(int codepoint) -
isScheme
public static boolean isScheme(int codepoint) -
isUserInfo
public static boolean isUserInfo(int codepoint) -
isQuery
public static boolean isQuery(int codepoint) -
isFragment
public static boolean isFragment(int codepoint) -
is_ucschar
public static boolean is_ucschar(int codepoint) -
is_iprivate
public static boolean is_iprivate(int codepoint) -
is_iunreserved
public static boolean is_iunreserved(int codepoint) -
is_ipchar
public static boolean is_ipchar(int codepoint) -
is_ipath
public static boolean is_ipath(int codepoint) -
is_ipathnodelims
public static boolean is_ipathnodelims(int codepoint) -
is_iquery
public static boolean is_iquery(int codepoint) -
is_ifragment
public static boolean is_ifragment(int codepoint) -
is_iregname
public static boolean is_iregname(int codepoint) -
is_ipliteral
public static boolean is_ipliteral(int codepoint) -
is_ihost
public static boolean is_ihost(int codepoint) -
is_regname
public static boolean is_regname(int codepoint) -
is_iuserinfo
public static boolean is_iuserinfo(int codepoint) -
is_iserver
public static boolean is_iserver(int codepoint) -
verify
Verifies a sequence of codepoints using the specified filter- Parameters:
aIter- Codepointer iteratoraFilter- filter
-
verify
Verifies a sequence of codepoints using the specified filter- Parameters:
aIter- codepoint iteratoreProfile- profile to use
-
verify
Verifies a sequence of codepoints using the specified profile- Parameters:
aArray- char arrayeProfile- profile to use
-
verify
Verifies a sequence of codepoints using the specified profile- Parameters:
sStr- StringeProfile- profile to use
-
verifyNot
Verifies a sequence of codepoints using the specified filter- Parameters:
aIter- Codepoint iteratoraFilter- Filter to use
-
verifyNot
Verifies a sequence of codepoints using the specified profile- Parameters:
aIter- Codepoint iteratoreProfile- profile to use
-
verifyNot
Verifies a sequence of codepoints using the specified profile- Parameters:
aArray- char arrayeProfile- profile to use
-