संदर्भ getString()

getString()

Return an attribute's value as a string.

The first parameter, name, is a string with the name of the attribute being checked. For example, calling myXML.getString('color') returns the element's id attribute as a string.

The second parameter, defaultValue, is optional. If a string is passed, as in myXML.getString('color', 'deeppink'), it will be returned if the attribute doesn't exist.

Note: Use myXML.getString() or myXML.getNum() to return an attribute's value.

उदाहरण

सिंटैक्स

getString(name, [defaultValue])

पैरामीटर्स

name
String:

name of the attribute to be checked.

defaultValue
Number:

value to return if the attribute doesn't exist.

Returns

String: attribute value as a string.
Notice any errors or typos? Please let us know. Please feel free to edit src/io/p5.XML.js and open a pull request!

संबंधित संदर्भ