(str: string)
| 39 | * @returns the converted hexadecimal value |
| 40 | */ |
| 41 | export function toHex(str: string) { |
| 42 | let res = ""; |
| 43 | let c = 0; |
| 44 | while (c < str.length) { |
| 45 | res += str.charCodeAt(c++).toString(16); |
| 46 | } |
| 47 | return res; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * returns true if the given string is a data url in the `data:[<mediatype>][;base64],<data>` format. |