Application Framework Reference

App Server Utilities API

normalize_value()

The normalize_value () function converts a string to either an integer or boolean value. If value cannot be cast to an integer the function tries to convert the string to boolean.

Synopsis

normValue = normalize_value( value )

Parameters

value

String

Value to be converted to integer or boolean.

Return Value

Integer

or

Boolean

Converted value .

Raises

ValueError

The specified value could not be converted to an integer or boolean value.

Example

from splunk.appserver.mrsparkle.lib import util
intVal = util.normalize_value('42')
boolVal = util.normalize_value('false')