# Conversion from a string

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