IsTrueString(str: String);
str. Checked string.
The IsTrueString method checks if the specified string contains only Boolean True or the value 1.
If the string contains only Boolean True or the value 1, the method returns True, otherwise the method returnsFalse.
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: