string¶
String data type, where the encoding will be determined by the runtime.
By default the string
is non-empty. That is, simply declaring string
, it is expected the string will have at least 1 character,
and cannot be blank. If a blank string is permitted, it should be declared as string(0,*)
.
Optional Parameters
Length constraint -
string( min, max )
, where min and max are numeric.Regex constraint - string(“:raw-html-m2r:`<pattern>”)
Regular expression pattern for a string value. The pattern should conform to ECMA-262/5.1. The string value assigned will need conform to the pattern.
An optional length can be specified to a string, which can be used for enforcing string length.
Examples
string(8,8)
A string of exactly 8 characters.string(1,*)
A non-empty string.string(0,100)
A string no longer than 100 characters.string( "\\b\\d{16}\\b" )
Expects the value to be a string which is 16 long comprised of digits only. E.g. credit card number.