1 |
|
2 |
|
3 | # Function string
|
4 |
|
5 | Create a string or convert any object into a string.
|
6 | Elements of Arrays and Matrices are processed element wise.
|
7 |
|
8 |
|
9 | ## Syntax
|
10 |
|
11 | ```js
|
12 | math.string(value)
|
13 | ```
|
14 |
|
15 | ### Parameters
|
16 |
|
17 | Parameter | Type | Description
|
18 | --------- | ---- | -----------
|
19 | `value` | * | Array | Matrix | null | A value to convert to a string
|
20 |
|
21 | ### Returns
|
22 |
|
23 | Type | Description
|
24 | ---- | -----------
|
25 | string | Array | Matrix | The created string
|
26 |
|
27 |
|
28 | ## Examples
|
29 |
|
30 | ```js
|
31 | math.string(4.2) // returns string '4.2'
|
32 | math.string(math.complex(3, 2) // returns string '3 + 2i'
|
33 |
|
34 | const u = math.unit(5, 'km')
|
35 | math.string(u.to('m')) // returns string '5000 m'
|
36 |
|
37 | math.string([true, false]) // returns ['true', 'false']
|
38 | ```
|
39 |
|
40 |
|
41 | ## See also
|
42 |
|
43 | [bignumber](bignumber.md),
|
44 | [boolean](boolean.md),
|
45 | [complex](complex.md),
|
46 | [index](index.md),
|
47 | [matrix](matrix.md),
|
48 | [number](number.md),
|
49 | [unit](unit.md)
|