Casting

Values can be converted into other types, making it easy to create, concatenate, and combine inspectors into complex expressions.

You can convert strings into integers:

  • Q: "500" as integer
  • A: 500

You can use the converted integers in math:

  • Q: ("500" as integer) * 5
  • A: 2500

You can convert integers to strings:

  • Q: 500 as string
  • A: 500

... and you can use concatenate to add text to your integers that you converted to strings:

  • Q: 500 as string & " hertz"
  • A: 500 hertz

You can work with dates:

  • Q: "01 Apr 2020" as date
  • A: Wed, 01 Apr 2020

You can turn the number of a month back into the name of the month:

  • Q: 5 as month
  • A: May

... and shorten the name of the month to its 3 or 4 letter abbreviation:

  • Q: january as three letters
  • A: Jan

The Relevance Debugger casts values to strings in order to print them. If an object does not result in a string, the debugger uses the as string method of the object to turn it into a string. If the object can’t be cast as a string, an error message is displayed.