# iconv() function

The iconv() function converts a value
from its external format to its internal equivalent, according to
the processing code being applied.

## Syntax

```
iconv(str.exp, conv.exp)
```

## Parameter(s)

| str.exp | Specifies the external value to convert to its equivalent internal value. |
| --- | --- |
| conv.exp | Specifies the processing code to use for the conversion. |

## Example(s)

This example converts `check.amount` to internal format, using the `"mr2"` conversion. Run time multiplies by 100 and truncates the decimal
portion.

```
check.amount = 12.5
print iconv(check.amount,"mr2")
1250
```
This example converts `check.date` to internal
format, using the `d` conversion.

```
check.date = "02/27/02"
print iconv(check.date,"d")
12477
```
This example performs an AQL group extract of two groups.

```
string = red*blue*green*yellow*orange
print iconv(string,’g0*2’)
red*blue
```
If `ans` contains `y` or `n`, the statements following the then clause
are executed.

```
input ans,1
if iconv(ans,"p(’y’);(’n’)")#"" then...
```

## See also

- [Conversion expression](https://d3codex.com/pickbasic-flashbasic/conversion-expression/)
- [d (date) processing code](https://d3codex.com/processingcodes/d-date-processing-code/)
- [date command](https://d3codex.com/tcl/date-command/)
- [BASIC functions](https://d3codex.com/pickbasic-flashbasic/basic-functions/)
- [m (mask) processing code](https://d3codex.com/processingcodes/m-mask-processing-code/)
- [Masking](https://d3codex.com/pickbasic-flashbasic/masking/)
- [match relational operator](https://d3codex.com/pickbasic-flashbasic/match-relational-operator/)
- [mc (mask character) processing code](https://d3codex.com/processingcodes/mc-mask-character-processing-code/)
- [mp (mask packed decimal) processing code](https://d3codex.com/processingcodes/mp-mask-packed-decimal-processing-code/)
- [mt (mask time) processing code](https://d3codex.com/processingcodes/mt-mask-time-processing-code/)
- [mx (mask ASCII to hexadecimal) processing code](https://d3codex.com/processingcodes/mx-mask-ascii-to-hexadecimal-processing-code/)
- [my (mask hexadecimal to ASCII) processing code](https://d3codex.com/processingcodes/my-mask-hexadecimal-to-ascii-processing-code/)
- [oconv() function](https://d3codex.com/pickbasic-flashbasic/oconv-function/)
- [set-date-std command](https://d3codex.com/tcl/set-date-std-command/)
- [Statements and functions](https://d3codex.com/pickbasic-flashbasic/statements-and-functions/)
- [t (text extraction) processing code](https://d3codex.com/processingcodes/t-text-extraction-processing-code/)
- [t (translate) processing code](https://d3codex.com/processingcodes/t-translate-processing-code/)
- [User exits](https://d3codex.com/definitions/user-exits/)

---
Source: https://d3codex.com/pickbasic-flashbasic/iconv-function/ - part of the D3Codex reference.
