0x00 through
0x7F), and to strings containing such characters.
ASCII utilities also exist in other classes of this package:
Charsets#US_ASCII specifies the Charset of ASCII characters.
CharMatcher#ascii matches ASCII characters and provides text processing methods
which operate only on the ASCII characters of a string.
| Modifier and Type | Field and Description |
|---|---|
| public static final byte | ACK
Acknowledge: A communication control character transmitted by a receiver as an affirmative response to a sender. |
| public static final byte | BEL
Bell ('\a'): A character for use when there is a need to call for human attention. |
| public static final byte | BS
Backspace ('\b'): A format effector which controls the movement of the printing position one printing space backward on the same printing line. |
| public static final byte | CAN
Cancel: A control character used to indicate that the data with which it is sent is in error or is to be disregarded. |
| private static final char | CASE_MASK
A bit mask which selects the bit encoding ASCII character case. |
| public static final byte | CR
Carriage Return ('\r'): A format effector which controls the movement of the printing position to the first printing position on the same printing line. |
| public static final byte | DC1
Device Control 1. |
| public static final byte | DC2
Device Control 2. |
| public static final byte | DC3
Device Control 3. |
| public static final byte | DC4
Device Control 4. |
| public static final byte | DEL
Delete: This character is used primarily to "erase" or "obliterate" erroneous or unwanted characters in perforated tape. |
| public static final byte | DLE
Data Link Escape: A communication control character which will change the meaning of a limited number of contiguously following characters. |
| public static final byte | EM
End of Medium: A control character associated with the sent data which may be used to identify the physical end of the medium, or the end of the used, or wanted, portion of information recorded on a medium. |
| public static final byte | ENQ
Enquiry: A communication control character used in data communication systems as a request for a response from a remote station. |
| public static final byte | EOT
End of Transmission: A communication control character used to indicate the conclusion of a transmission, which may have contained one or more texts and any associated headings. |
| public static final byte | ESC
Escape: A control character intended to provide code extension (supplementary characters) in general information interchange. |
| public static final byte | ETB
End of Transmission Block: A communication control character used to indicate the end of a block of data for communication purposes. |
| public static final byte | ETX
End of Text: A communication control character used to terminate a sequence of characters started with STX and transmitted as an entity. |
| public static final byte | FF
Form Feed ('\f'): A format effector which controls the movement of the printing position to the first pre-determined printing line on the next form or page. |
| public static final byte | FS
File Separator: These four information separators may be used within data in optional fashion, except that their hierarchical relationship shall be: FS is the most inclusive, then GS, then RS, and US is least inclusive. |
| public static final byte | GS
Group Separator: These four information separators may be used within data in optional fashion, except that their hierarchical relationship shall be: FS is the most inclusive, then GS, then RS, and US is least inclusive. |
| public static final byte | HT
Horizontal Tabulation ('\t'): A format effector which controls the movement of the printing position to the next in a series of predetermined positions along the printing line. |
| public static final byte | LF
Line Feed ('\n'): A format effector which controls the movement of the printing position to the next printing line. |
| public static final char | MAX
The maximum value of an ASCII character. |
| public static final char | MIN
The minimum value of an ASCII character. |
| public static final byte | NAK
Negative Acknowledge: A communication control character transmitted by a receiver as a negative response to the sender. |
| public static final byte | |
| public static final byte | NUL
Null ('\0'): The all-zeros character which may serve to accomplish time fill and media fill. |
| public static final byte | RS
Record Separator: These four information separators may be used within data in optional fashion, except that their hierarchical relationship shall be: FS is the most inclusive, then GS, then RS, and US is least inclusive. |
| public static final byte | SI
Shift In: A control character indicating that the code combinations which follow shall be interpreted according to the standard code table. |
| public static final byte | SO
Shift Out: A control character indicating that the code combinations which follow shall be interpreted as outside of the character set of the standard code table until a Shift In character is reached. |
| public static final byte | SOH
Start of Heading: A communication control character used at the beginning of a sequence of characters which constitute a machine-sensible address or routing information. |
| public static final byte | SP
Space: A normally non-printing graphic character used to separate words. |
| public static final byte | |
| public static final byte | STX
Start of Text: A communication control character which precedes a sequence of characters that is to be treated as an entity and entirely transmitted through to the ultimate destination. |
| public static final byte | SUB
Substitute: A character that may be substituted for a character which is determined to be invalid or in error. |
| public static final byte | SYN
Synchronous Idle: A communication control character used by a synchronous transmission system in the absence of any other character to provide a signal from which synchronism may be achieved or retained. |
| public static final byte | US
Unit Separator: These four information separators may be used within data in optional fashion, except that their hierarchical relationship shall be: FS is the most inclusive, then GS, then RS, and US is least inclusive. |
| public static final byte | VT
Vertical Tabulation ('\v'): A format effector which controls the movement of the printing position to the next in a series of predetermined printing lines. |
| public static final byte | XOFF
Transmission off. |
| public static final byte | XON
Transmission On: Although originally defined as DC1, this ASCII control character is now better known as the XON code used for software flow control in serial communications. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static boolean | equalsIgnoreCase(CharSequence s1, CharSequence s2)
Indicates whether the contents of the given character sequences |
| private static int | getAlphaIndex(char c)
Returns the non-negative index value of the alpha character |
| public static boolean | isLowerCase(char c)
Indicates whether |
| public static boolean | isUpperCase(char c)
Indicates whether |
| public static String | toLowerCase(String string)
Returns a copy of the input string in which all uppercase ASCII characters have been converted to lowercase. |
| public static String | toLowerCase(CharSequence chars)
Returns a copy of the input character sequence in which all uppercase ASCII characters have been converted to lowercase. |
| public static char | toLowerCase(char c)
If the argument is an uppercase ASCII character, returns the lowercase equivalent. |
| public static String | toUpperCase(String string)
Returns a copy of the input string in which all lowercase ASCII characters have been converted to uppercase. |
| public static String | toUpperCase(CharSequence chars)
Returns a copy of the input character sequence in which all lowercase ASCII characters have been converted to uppercase. |
| public static char | toUpperCase(char c)
If the argument is a lowercase ASCII character, returns the uppercase equivalent. |
| public static String | truncate(CharSequence seq, int maxLength, String truncationIndicator)
Truncates the given character sequence to the given maximum length. |
| ACK | back to summary |
|---|---|
| public static final byte ACK Acknowledge: A communication control character transmitted by a receiver as an affirmative response to a sender.
| |
| BEL | back to summary |
|---|---|
| public static final byte BEL Bell ('\a'): A character for use when there is a need to call for human attention. It may control alarm or attention devices.
| |
| BS | back to summary |
|---|---|
| public static final byte BS Backspace ('\b'): A format effector which controls the movement of the printing position one printing space backward on the same printing line. (Applicable also to display devices.)
| |
| CAN | back to summary |
|---|---|
| public static final byte CAN Cancel: A control character used to indicate that the data with which it is sent is in error or is to be disregarded.
| |
| CASE_MASK | back to summary |
|---|---|
| private static final char CASE_MASK A bit mask which selects the bit encoding ASCII character case. | |
| CR | back to summary |
|---|---|
| public static final byte CR Carriage Return ('\r'): A format effector which controls the movement of the printing position to the first printing position on the same printing line. (Applicable also to display devices.)
| |
| DC1 | back to summary |
|---|---|
| public static final byte DC1 Device Control 1. Characters for the control of ancillary devices associated with data processing or telecommunication systems, more especially switching devices "on" or "off." (If a single "stop" control is required to interrupt or turn off ancillary devices, DC4 is the preferred assignment.)
| |
| DC2 | back to summary |
|---|---|
| public static final byte DC2 Device Control 2. Characters for the control of ancillary devices associated with data processing or telecommunication systems, more especially switching devices "on" or "off." (If a single "stop" control is required to interrupt or turn off ancillary devices, DC4 is the preferred assignment.)
| |
| DC3 | back to summary |
|---|---|
| public static final byte DC3 Device Control 3. Characters for the control of ancillary devices associated with data processing or telecommunication systems, more especially switching devices "on" or "off." (If a single "stop" control is required to interrupt or turn off ancillary devices, DC4 is the preferred assignment.)
| |
| DC4 | back to summary |
|---|---|
| public static final byte DC4 Device Control 4. Characters for the control of ancillary devices associated with data processing or telecommunication systems, more especially switching devices "on" or "off." (If a single "stop" control is required to interrupt or turn off ancillary devices, DC4 is the preferred assignment.)
| |
| DEL | back to summary |
|---|---|
| public static final byte DEL Delete: This character is used primarily to "erase" or "obliterate" erroneous or unwanted characters in perforated tape.
| |
| DLE | back to summary |
|---|---|
| public static final byte DLE Data Link Escape: A communication control character which will change the meaning of a limited number of contiguously following characters. It is used exclusively to provide supplementary controls in data communication networks.
| |
| EM | back to summary |
|---|---|
| public static final byte EM End of Medium: A control character associated with the sent data which may be used to identify the physical end of the medium, or the end of the used, or wanted, portion of information recorded on a medium. (The position of this character does not necessarily correspond to the physical end of the medium.)
| |
| ENQ | back to summary |
|---|---|
| public static final byte ENQ Enquiry: A communication control character used in data communication systems as a request for a response from a remote station. It may be used as a "Who Are You" (WRU) to obtain identification, or may be used to obtain station status, or both.
| |
| EOT | back to summary |
|---|---|
| public static final byte EOT End of Transmission: A communication control character used to indicate the conclusion of a transmission, which may have contained one or more texts and any associated headings.
| |
| ESC | back to summary |
|---|---|
| public static final byte ESC Escape: A control character intended to provide code extension (supplementary characters) in general information interchange. The Escape character itself is a prefix affecting the interpretation of a limited number of contiguously following characters.
| |
| ETB | back to summary |
|---|---|
| public static final byte ETB End of Transmission Block: A communication control character used to indicate the end of a block of data for communication purposes. ETB is used for blocking data where the block structure is not necessarily related to the processing format.
| |
| ETX | back to summary |
|---|---|
| public static final byte ETX End of Text: A communication control character used to terminate a sequence of characters started with STX and transmitted as an entity.
| |
| FF | back to summary |
|---|---|
| public static final byte FF Form Feed ('\f'): A format effector which controls the movement of the printing position to the first pre-determined printing line on the next form or page. (Applicable also to display devices.)
| |
| FS | back to summary |
|---|---|
| public static final byte FS File Separator: These four information separators may be used within data in optional fashion, except that their hierarchical relationship shall be: FS is the most inclusive, then GS, then RS, and US is least inclusive. (The content and length of a File, Group, Record, or Unit are not specified.)
| |
| GS | back to summary |
|---|---|
| public static final byte GS Group Separator: These four information separators may be used within data in optional fashion, except that their hierarchical relationship shall be: FS is the most inclusive, then GS, then RS, and US is least inclusive. (The content and length of a File, Group, Record, or Unit are not specified.)
| |
| HT | back to summary |
|---|---|
| public static final byte HT Horizontal Tabulation ('\t'): A format effector which controls the movement of the printing position to the next in a series of predetermined positions along the printing line. (Applicable also to display devices and the skip function on punched cards.)
| |
| LF | back to summary |
|---|---|
| public static final byte LF Line Feed ('\n'): A format effector which controls the movement of the printing position to the next printing line. (Applicable also to display devices.) Where appropriate, this character may have the meaning "New Line" (NL), a format effector which controls the movement of the printing point to the first printing position on the next printing line. Use of this convention requires agreement between sender and recipient of data.
| |
| MAX | back to summary |
|---|---|
| public static final char MAX The maximum value of an ASCII character.
| |
| MIN | back to summary |
|---|---|
| public static final char MIN The minimum value of an ASCII character.
| |
| NAK | back to summary |
|---|---|
| public static final byte NAK Negative Acknowledge: A communication control character transmitted by a receiver as a negative response to the sender.
| |
| NL | back to summary |
|---|---|
| public static final byte NL Alternate name for
| |
| NUL | back to summary |
|---|---|
| public static final byte NUL Null ('\0'): The all-zeros character which may serve to accomplish time fill and media fill. Normally used as a C string terminator. Although RFC 20 names this as "Null", note that it is distinct from the C/C++ "NULL" pointer.
| |
| RS | back to summary |
|---|---|
| public static final byte RS Record Separator: These four information separators may be used within data in optional fashion, except that their hierarchical relationship shall be: FS is the most inclusive, then GS, then RS, and US is least inclusive. (The content and length of a File, Group, Record, or Unit are not specified.)
| |
| SI | back to summary |
|---|---|
| public static final byte SI Shift In: A control character indicating that the code combinations which follow shall be interpreted according to the standard code table.
| |
| SO | back to summary |
|---|---|
| public static final byte SO Shift Out: A control character indicating that the code combinations which follow shall be interpreted as outside of the character set of the standard code table until a Shift In character is reached.
| |
| SOH | back to summary |
|---|---|
| public static final byte SOH Start of Heading: A communication control character used at the beginning of a sequence of characters which constitute a machine-sensible address or routing information. Such a sequence is referred to as the "heading." An STX character has the effect of terminating a heading.
| |
| SP | back to summary |
|---|---|
| public static final byte SP Space: A normally non-printing graphic character used to separate words. It is also a format effector which controls the movement of the printing position, one printing position forward. (Applicable also to display devices.)
| |
| SPACE | back to summary |
|---|---|
| public static final byte SPACE Alternate name for
| |
| STX | back to summary |
|---|---|
| public static final byte STX Start of Text: A communication control character which precedes a sequence of characters that is to be treated as an entity and entirely transmitted through to the ultimate destination. Such a sequence is referred to as "text." STX may be used to terminate a sequence of characters started by SOH.
| |
| SUB | back to summary |
|---|---|
| public static final byte SUB Substitute: A character that may be substituted for a character which is determined to be invalid or in error.
| |
| SYN | back to summary |
|---|---|
| public static final byte SYN Synchronous Idle: A communication control character used by a synchronous transmission system in the absence of any other character to provide a signal from which synchronism may be achieved or retained.
| |
| US | back to summary |
|---|---|
| public static final byte US Unit Separator: These four information separators may be used within data in optional fashion, except that their hierarchical relationship shall be: FS is the most inclusive, then GS, then RS, and US is least inclusive. (The content and length of a File, Group, Record, or Unit are not specified.)
| |
| VT | back to summary |
|---|---|
| public static final byte VT Vertical Tabulation ('\v'): A format effector which controls the movement of the printing position to the next in a series of predetermined printing lines. (Applicable also to display devices.)
| |
| XOFF | back to summary |
|---|---|
| public static final byte XOFF Transmission off. See
| |
| XON | back to summary |
|---|---|
| public static final byte XON Transmission On: Although originally defined as DC1, this ASCII control character is now better known as the XON code used for software flow control in serial communications. The main use is restarting the transmission after the communication has been stopped by the XOFF control code.
| |
| Ascii | back to summary |
|---|---|
| private Ascii() | |
| equalsIgnoreCase | back to summary |
|---|---|
| public static boolean equalsIgnoreCase(CharSequence s1, CharSequence s2) Indicates whether the contents of the given character sequences This method is significantly faster than Note however that this method does not always behave identically to expressions such as:
due to case-folding of some non-ASCII characters (which does not occur in
| |
| getAlphaIndex | back to summary |
|---|---|
| private static int getAlphaIndex(char c) Returns the non-negative index value of the alpha character | |
| isLowerCase | back to summary |
|---|---|
| public static boolean isLowerCase(char c) Indicates whether | |
| isUpperCase | back to summary |
|---|---|
| public static boolean isUpperCase(char c) Indicates whether | |
| toLowerCase | back to summary |
|---|---|
| public static String toLowerCase(String string) Returns a copy of the input string in which all uppercase ASCII characters have been converted to lowercase. All other characters are copied without modification. | |
| toLowerCase | back to summary |
|---|---|
| public static String toLowerCase(CharSequence chars) Returns a copy of the input character sequence in which all uppercase ASCII characters have been converted to lowercase. All other characters are copied without modification.
| |
| toLowerCase | back to summary |
|---|---|
| public static char toLowerCase(char c) If the argument is an uppercase ASCII character, returns the lowercase equivalent. Otherwise returns the argument. | |
| toUpperCase | back to summary |
|---|---|
| public static String toUpperCase(String string) Returns a copy of the input string in which all lowercase ASCII characters have been converted to uppercase. All other characters are copied without modification. | |
| toUpperCase | back to summary |
|---|---|
| public static String toUpperCase(CharSequence chars) Returns a copy of the input character sequence in which all lowercase ASCII characters have been converted to uppercase. All other characters are copied without modification.
| |
| toUpperCase | back to summary |
|---|---|
| public static char toUpperCase(char c) If the argument is a lowercase ASCII character, returns the uppercase equivalent. Otherwise returns the argument. | |
| truncate | back to summary |
|---|---|
| public static String truncate(CharSequence seq, int maxLength, String truncationIndicator) Truncates the given character sequence to the given maximum length. If the length of the
sequence is greater than Examples:
Note: This method may work with certain non-ASCII text but is not safe for use with arbitrary Unicode text. It is mostly intended for use with text that is known to be safe for use with it (such as all-ASCII text) and for simple debugging text. When using this method, consider the following:
| |