Format Strings

With Dataceptor you can use format strings to change the way data is formatted when showed to the end user.

The syntax of a format string is based on Microsoft.NET data formatting. Different syntax is used for numbers, dates, and normal text. 

When formatting a data value you write an expression including {0}, which represents the data value for the displayed field. You can add formatting information to the data value based on the data type. Specifying {0:0.00} will format decimal numbers with two decimals. More examples are listed in the table below.

Data Value Format Result
33.1234 {0} 33.1234
33.1234 {0:0.00} 33.12
33.1234 ab{0}c ab33.1234c
0.25 {0:%#0.00} %25
abc 11{0}22 11abc22
2018-12-31 {0:M/d-yyyy} 12/31-2018
2018-12-31 {0:yyyy/MM/dd} 2018/12/31

Please note that formatting can be affected by the regional settings on the server.

Special Dataceptor Formats

In addition to the normal Microsoft.NET formats, the Dataceptor has some additional formats.

Name Description Example
UPPERCASE Converts all letters to upper case letters.

{0:UPPERCASE}

abc => ABC

LOWERCASE Converts all letters to lower case letters.

{0:LOWERCASE}

ABC => abc

URLDATA Encodes URL data.

{0:URLDATA}

a+b => a%2Bb

Data Values

FIELD

NOW

TODAY

TIME

 

Links