|  | Home · All Classes · Modules

# QScriptString Class Reference
[QtScript module]

The QScriptString class acts as a handle to "interned" strings in a QScriptEngine. More...

### Methods

- __init__ (self)
- __init__ (self, QScriptString other)
- bool isValid (self)
- QString toString (self)

### Special Methods

- bool __eq__ (self, QScriptString other)
- bool __ne__ (self, QScriptString other)

## Detailed Description

The QScriptString class acts as a handle to "interned" strings in a QScriptEngine.

QScriptString can be used to achieve faster (repeated) property getting/setting, and comparison of property names, of script objects.

To get a QScriptString representation of a string, pass the string to QScriptEngine.toStringHandle(). The typical usage pattern is to register one or more pre-defined strings when setting up your script environment, then subsequently use the relevant QScriptString as argument to e.g. QScriptValue.property().

Call the toString() function to obtain the string that a QScriptString represents.

## Method Documentation

### QScriptString.__init__ (self)

Constructs an invalid QScriptString.

### QScriptString.__init__ (self, QScriptString other)

Constructs a new QScriptString that is a copy of other.

### bool QScriptString.isValid (self)

Returns true if this QScriptString is valid; otherwise returns false.

### QString QScriptString.toString (self)

Returns the string that this QScriptString represents, or a null string if this QScriptString is not valid.

See also isValid().

### bool QScriptString.__eq__ (self, QScriptString other)

### bool QScriptString.__ne__ (self, QScriptString other)