Last Updated on : 2024-06-05 03:14:36download
This topic describes the utility methods related to strings.
hexStringToNumber
Convert a specified hexadecimal string to an array.
Name | Data type | Description | Required |
---|---|---|---|
bits | string | The hexadecimal string. | Yes |
Name | Data type | Description |
---|---|---|
result | number | The array that is converted from the specified hexadecimal string. |
import { Utils } from "tuya-panel-kit";
const { hexStringToNumber } = Utils.StringUtils;
hexStringToNumber(bits);
// Example:
hexStringToNumber("AD03");
[173, 3]
hexStringToBinString
Convert a hexadecimal string to a binary string.
Name | Data type | Description | Required |
---|---|---|---|
str | string | str is a hexadecimal string. |
Yes |
Name | Data type | Description |
---|---|---|
result | string | The string that is converted from str . It contains 0 and 1 . |
import { Utils } from "tuya-panel-kit";
const { hexStringToBinString } = Utils.StringUtils;
hexStringToBinString(str);
// Example:
hexStringToBinString("A7B9");
hexStringToBinString("0709");
1010011110111001
0000011100001001
camelize
Remove all hyphens (-
) or underlines (_
) from a string and capitalize the first character that follows the hyphens or underlines.
Name | Data type | Description | Required |
---|---|---|---|
str | string | String | Yes |
Name | Data type | Description |
---|---|---|
result | string | The returned string in the camel case format. |
import { Utils } from "tuya-panel-kit";
const { camelize } = Utils.StringUtils;
camelize(str);
// Example:
camelize("abb_aa-cc");
abbAaCc
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback