string()

Read(269) Label: convert, format string,

Here’s how to use string() function.

string( expression {, format })

Description:

Convert the data type of an object to the string type.

Syntax:

string(expression{, format})

Note:

The function converts the data type of an object to the string type and formats the string.The format string format must match the data type of the result of expression, or the result of string(expression{, format}) will be incorrect.

Parameters:

expression

The constant object or the expression to be converted to a string.

format

A format string used to format the result of expression

Options:

@q

Enclosed the string expression in double quotes and ignore parameter format

@e

Escape the undisplayable character. Represent the tab, carriage return, line break in the string expression with the escape characters. Add an escape character before the single quotes, double quotes or an escape character if there is any in the string. Ignore parameter format

@u

With the use of @e option, if there is a character of large charaset in the string expression, convert the character to a Unicode character

Return value:

String

Example:

 

A

 

1

=string(123)

123

2

=string(date("2009-02-23")," MMM dd, yyyy")

Feb 23, 2009

3

=string(3456.78,"$#,##0.00")

$3,456.78

4

=string(5/6,"0.00%")

83.33%

5

a  b

Separate a and b with tab

6

=string@q(A5)

"a  b" Double quoted the given character string a b, and display the escape character

7

=string@e(A6)

\"a\tb\" Do not display the character tab after the string is escaped; and add escape character to the double quotes

8

 中国

 

9

=string@u(A8)

\u4E2D\u56FD

Related functions:

float()

int()

long()

number()

decimal()