Boolean |
Returns true only if the string is equal to
"true", regardless of the case. Otherwise it returns
false. This conversion can cause a loss of data. |
- "TrUe" is converted to true.
- An empty string is converted to false.
- "Hello" is converted to false.
|
Integer |
Converts the string to an integer if possible, returns an exception otherwise.
This conversion can cause a loss of data. |
- "1" is converted to 1.
- "3.1415" is converted to 3.
-
"Hello" cannot be converted and returns
an exception.
- An empty string cannot be converted and returns an
exception.
|
Decimal |
Converts the string to a decimal if possible, returns an exception otherwise. This conversion can cause a loss of data. |
- "1" is converted to 1.
- "3.1415" is converted to 3.1415.
-
"Hello" cannot be converted and returns
an exception.
- An empty string cannot be converted and returns an
exception.
|
Double |
Converts the string to a double if possible, returns an exception otherwise. This conversion can cause a loss of data. |
- "1" is converted to 1.0D.
- "3.1415" is converted to 3.1415D.
-
"Hello" cannot be converted and returns
an exception.
- An empty string cannot be converted and returns an
exception.
|
Float |
Converts the string to a float if possible, returns an exception otherwise. This conversion can cause a loss of data. |
- "1" is converted to 1.0F.
- "3.1415" is converted to 3.1415F.
-
"Hello" cannot be converted and returns
an exception.
- An empty string cannot be converted and returns an
exception.
|
Long |
Converts the string to a long if possible, returns an exception otherwise. This conversion can cause a loss of data. |
- "1" is converted to 1L.
- "3.1415" is converted to 3L.
-
"Hello" cannot be converted and returns
an exception.
- An empty string cannot be converted and returns an
exception.
|