Castable expressions

Figure 65. CastableExpr

CastableExpr

A castable expression checks whether a JSONiq value can be cast to a given atomic type and returns true or false accordingly. It can be used before actually casting to that type.

Example 153. Castable as expression

"1" castable as integer
      

Result (run with Zorba): true


Example 154. Castable as expression

"foo" castable as integer
      

Result (run with Zorba): false


Example 155. Castable as expression

"2013-04-02" castable as date
      

Result (run with Zorba): true


Example 156. Castable as expression

() castable as date
      

Result (run with Zorba): false


Example 157. Castable as expression

("2013-04-02", "2013-04-03") castable as date
      

Result (run with Zorba): false


The question mark allows for an empty sequence.

Example 158. Castable as expression

() castable as date?
      

Result (run with Zorba): true