isstr()
The isstr() function checks whether the value passed as an argument is a string type and returns a boolean.
Syntax
isstr(EXPR)
Parameters
EXPR- A field name or expression whose type to check.
Description
The isstr() function returns true if the result of evaluating EXPR is a string type, and false otherwise.
If the result of evaluating EXPR is null, returns false because null is not a string.
Error codes
N/A
Usage examples
To prepare the WEB_APACHE_SAMPLE table used in these examples, refer to Preparing sample data.
-
Checking the string-type
methodfieldtable limit=5 WEB_APACHE_SAMPLE | eval result = isstr(method) | fields method, result | # result: true -
Checking the integer-type
statusfieldtable limit=5 WEB_APACHE_SAMPLE | eval result = isstr(status) | fields status, result | # result: false -
NULL input
json "{'val': null}" | eval result = isstr(val) | # result: false
Compatibility
The isstr() function has been available since before Sonar 4.0.