Home > Contents > Index >
Expanded TOC | Accordion TOC | Annotated TOC | Index
Utilities.deBabble
Replaces the character encoding strings--%20 (space), %22 ("), %12 ( ), %3c (<), %3e (>), and %26 (&)--in an input string with the characters they represent.
Syntax
static final String deBabble(String str)Parameters
str
- String to convert.
Description
Certain reserved characters (such as <) can be encoded into their hexadecimal equivalents (for example,
%3c
). ThedeBabble
method replaces these hexadecimal equivalents with the actual character name; for example,deBabble
converts%3c
back into the less-than sign (<)
. ThedeBabble
method can convert the following hexadecimal values:
Hexadecimal String deBabble Replacement%20
space%22
double quote ("
)%25
percent (%
)%26
ampersand (&
)%0a
line feed ()
%09
tab%0d
carriage return ()
%3c
less than (<
)
Returns
Returns the converted string, or the same string if no conversion was done.
Example
The following fragment converts a string containing some embedded hexadecimal characters:
String AStringContainingHex = "apples%26bananas%3coranges"; String deBabbledStr = Utilities.deBabble(AStringContainingHex);After executing the preceding code, the
deBabbledStr
object should contain the following:
apples&bananas<oranges
Home > Contents > Index > Oracle JAVA Reference
Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.