ftos.convert.hex.toBase64
Converts a hexadecimal string representation to a Base64 encoded string.
Syntax
Copy
ftos.convert.hex.toBase64(hex: string): string;
| Parameter | Type | Description |
|---|---|---|
hex
|
string | A continuous hexadecimal string representing the data.
Each byte must be represented by two uppercase hexadecimal characters (digits 0–9 and letters A–F). E.g.: "48656C6C6F". IMPORTANT! Only continuous hexadecimal strings are accepted, without spaces, tabs, or separators. E.g.: 48656C6C6F is valid, but 48 65 6C 6C 6F will cause incorrect processing. |
Return Value
A Base64-encoded string converted from the hexadecimal input string.
Example
This example:
- Takes the 48656C6C6F20576F726C64 hexadecimal string, which encodes the text Hello World.
- Converts it to Base64 SGVsbG8gV29ybGQ=.
- Stores the result in the baseData variable.
Copy
var baseData = ftos.convert.hex.toBase64('48656C6C6F20576F726C64');