Convert value to string type.
| Argument |
Description |
Type |
string |
Converted string |
string |
| Parameter |
Description |
Type |
Default |
value |
Value to convert |
string | number |
Required |
import { toString } from 'ranuts';
const str1 = toString(123);
console.log(str1); // '123'
const str2 = toString('hello');
console.log(str2); // 'hello'
import { toString } from 'ranuts';
const num = 42;
const str = toString(num);
console.log(typeof str); // 'string'
- Simple wrapper: This is a simple wrapper for
String() function.
- Type support: Supports string and number type conversion.
- Use case: Commonly used for type conversion, string processing, etc.