public class JSString extends JSPrimitive<java.lang.String>
Modifier and Type | Method and Description |
---|---|
JSString |
asString()
Casts the current JavaScript object to
将当前的JavaScript对象转换为JSString类型。 JSString type.
|
java.lang.String |
getStringValue()
Returns string value of the current JavaScript object if object represents a primitive string or String object, otherwise throws
如果object表示原始字符串或String对象,则返回当前JavaScript对象的字符串值,否则抛出IllegalStateException。 IllegalStateException .
|
java.lang.String |
getValue()
Returns the value of the current primitive instance.
返回当前原始实例的值。 |
boolean |
isString()
Indicates whether JavaScript value is a string.
指示JavaScript值是否为字符串。 |
toString
asArray, asBoolean, asBooleanObject, asFunction, asJavaObject, asNumber, asNumberObject, asObject, asStringObject, getBooleanValue, getNumberValue, isArray, isBoolean, isBooleanObject, isFunction, isJavaObject, isNull, isNumber, isNumberObject, isObject, isStringObject, isUndefined
public java.lang.String getStringValue()
JSValue
IllegalStateException
.
getStringValue
in class
JSValue
public boolean isString()
JSValue
true
, then the value can be casted to
JSString
type. For example:
if (value.isString()) { JSString string = value.asString(); }
public JSString asString()
JSValue
JSString
type. If the current object doesn't represent a string value, the
IllegalStateException
error is thrown.
public java.lang.String getValue()
JSPrimitive
getValue
in class
JSPrimitive<java.lang.String>