Class LinkUtilities
java.lang.Object
com.ibm.icu.util.LinkUtilities
Utility class for assisting with detecting links (URLs or emails) in text, and formatting them
for display, implementing the algorithms in https://www.unicode.org/reports/tr58/ to handle
Unicode characters properly. It supplies lower level APIs for use in augmenting existing scanners
and formatters.
- Status:
- Draft ICU 79.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum for determining whether any percent-escaping is minimal or maximal, for use with.invalid reference
#escapePathQueryFragment() -
Method Summary
Modifier and TypeMethodDescriptionstatic StringescapePathQueryFragment(String source, LinkUtilities.Extent extent) Escapes a URL according to the Extent parameterstatic intscanBackEmailLocalPart(CharSequence source, int start, int limit) Lower level utility for finding the start of an email address in text.static intscanPathQueryFragment(CharSequence source, int start, int limit) Lower level utility for finding the end of a PathQueryFragment (PQF) in text.
-
Method Details
-
scanPathQueryFragment
Lower level utility for finding the end of a PathQueryFragment (PQF) in text. It assumes that the start position is immediately after an identified domain name. The purpose of this routine is for fitting into algorithms that are already in use, just taking over for the PQF scanning. For more information, see https://www.unicode.org/reports/tr58/.- Parameters:
source- the text to be scannedstart- the position in the text to be scanned from. It should be immediately after a domain name.- Returns:
- the exclusive-end position of the PQF, or the start value if there is none.
- Status:
- Draft ICU 79.
-
scanBackEmailLocalPart
Lower level utility for finding the start of an email address in text. It assumes that the limit position is at an '@' + identified domain name, and will scan backwards from there. The purpose of this routine is for fitting into algorithms that are already in use, just handling the emaillocal-part. It does not scan back through "mailto:".- Parameters:
source- the text to be scannedstart- the position that is the earliest that should be considered in a backwards scanlimit- the position to start scanning backwards from — should be the position of the '@' (which is just before the domain_name)- Returns:
- the start of the email local part, or limit if no email local part is found
- Status:
- Draft ICU 79.
-
escapePathQueryFragment
Escapes a URL according to the Extent parameter- Parameters:
source- In the source, it is assumed that ASCII syntax characters requiring escaping have already been escaped. For example, a literal / in a path segment would already be percent-escaped. For more information, see https://www.unicode.org/reports/tr58/.extent- either MINIMAL or MAXIMAL- Returns:
- an escaped string according to the extent parameter.
- Status:
- Draft ICU 79.
-