PP.IsTrueString

Syntax

IsTrueString(str: String);

Parameters

str. Checked string.

Description

The IsTrueString method checks if the specified string contains only Boolean True or the value 1.

Comments

If the string contains only Boolean True or the value 1, the method returns True, otherwise the method returnsFalse.

Example

To execute the example, add a link to PP.js scenario file to HTML page. Invert the Boolean True presented as a string:

// Determine a string that contains true logical value
var str = "1";
if (PP.isString(str) && PP.IsTrueString(str)) {
    // Transform string to Boolean value and invert it
    var result = !Boolean(str);
    if (PP.isBoolean(result)) {
        console.log("Inverted logical value: " + result);
    }
} else {
    console.log("String does not contain true logical value.");
};

After executing the example the browser console displays the value False:

Inverted Boolean value: False

See also:

PP