public class Whitespace
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Whitespace.Tokenizer
An iterator that splits a string on whitespace boundaries, corresponding to the XPath 3.1 function tokenize#1
|
| Modifier and Type | Field and Description |
|---|---|
static int |
ALL |
static int |
COLLAPSE |
static int |
IGNORABLE |
static int |
NONE
The values NONE, IGNORABLE, and ALL identify which kinds of whitespace text node
should be stripped when building a source tree.
|
static int |
PRESERVE
The values PRESERVE, REPLACE, and COLLAPSE represent the three options for whitespace
normalization.
|
static int |
REPLACE |
static int |
TRIM |
static int |
UNSPECIFIED |
static int |
XSLT |
| Modifier and Type | Method and Description |
|---|---|
static UnicodeString |
applyWhitespaceNormalization(int action,
UnicodeString value)
Apply schema-defined whitespace normalization to a string
|
static java.lang.String |
collapse(java.lang.CharSequence in) |
static UnicodeString |
collapse(UnicodeString in) |
static java.lang.String |
collapseWhitespace(java.lang.String in)
Collapse whitespace as defined in XML Schema.
|
static UnicodeString |
collapseWhitespace(UnicodeString in)
Collapse whitespace as defined in XML Schema.
|
static boolean |
containsWhitespace(IntIterator codePoints)
Determine if a string contains any whitespace
|
static boolean |
isAllWhite(UnicodeString content)
Determine if a string is all-whitespace
|
static boolean |
isWhite(int c)
Determine if a character is whitespace
|
static java.lang.String |
normalize(java.lang.CharSequence in) |
static UnicodeString |
normalize(UnicodeString in) |
static UnicodeString |
normalizeWhitespace(UnicodeString input)
Normalize whitespace as defined in XML Schema.
|
static java.lang.String |
removeAllWhitespace(java.lang.String value)
Remove all whitespace characters from a string
|
static UnicodeString |
removeLeadingWhitespace(UnicodeString value)
Remove leading whitespace characters from a string
|
static java.lang.String |
trim(java.lang.String in)
Trim whitespace: return the input string with leading and trailing whitespace removed.
|
static UnicodeString |
trim(UnicodeString in)
Trim whitespace: return the input string with leading and trailing whitespace removed
|
static long |
trimmedEnd(UnicodeString in)
Get the codepoint offset of the first whitespace character in trailing whitespace in the string
|
static long |
trimmedStart(UnicodeString in)
Get the codepoint offset of the first non-whitespace character in the string
|
public static final int PRESERVE
public static final int REPLACE
public static final int COLLAPSE
public static final int TRIM
public static final int NONE
public static final int IGNORABLE
public static final int ALL
public static final int UNSPECIFIED
public static final int XSLT
public static UnicodeString applyWhitespaceNormalization(int action, UnicodeString value)
action - the action to be applied: one of PRESERVE, REPLACE, or COLLAPSEvalue - the value to be normalizedpublic static java.lang.String removeAllWhitespace(java.lang.String value)
value - the string from which whitespace is to be removedpublic static UnicodeString removeLeadingWhitespace(UnicodeString value)
value - the string whose leading whitespace is to be removedpublic static boolean containsWhitespace(IntIterator codePoints)
codePoints - the string to be tested, as a codepoint iteratorpublic static boolean isAllWhite(UnicodeString content)
content - the string to be testedpublic static boolean isWhite(int c)
c - the character or codepoint to be testedpublic static UnicodeString normalizeWhitespace(UnicodeString input)
collapseWhitespace(net.sf.saxon.str.UnicodeString) methodinput - the string to be normalizedpublic static UnicodeString collapseWhitespace(UnicodeString in)
in - the string whose whitespace is to be collapsedpublic static java.lang.String collapseWhitespace(java.lang.String in)
in - the string whose whitespace is to be collapsedpublic static long trimmedStart(UnicodeString in)
in - the input stringpublic static long trimmedEnd(UnicodeString in)
in - the input stringpublic static UnicodeString trim(UnicodeString in)
in - the input stringpublic static java.lang.String trim(java.lang.String in)
String.trim() because the definition of whitespace
is different.in - the input stringpublic static UnicodeString collapse(UnicodeString in)
public static java.lang.String collapse(java.lang.CharSequence in)
public static UnicodeString normalize(UnicodeString in)
public static java.lang.String normalize(java.lang.CharSequence in)
Copyright (c) 2004-2022 Saxonica Limited. All rights reserved.