NSString(MBExpression) Category Reference

Declared in MBExpressionExtensions.h

Overview

This NSString class category adds methods for evaluating expressions directly from NSString instances.

– evaluateAsObject

Evaluates the receiver as an expression returning an object.

- (nullable id)evaluateAsObject

Return Value

The result of evaluating the receiver as an object expression.

Discussion

Equivalent to calling [MBExpression asObject:] with the receiver as the parameter.

Declared In

MBExpressionExtensions.h

– evaluateAsString

Evaluates the receiver as an expression returning a string.

- (nullable NSString *)evaluateAsString

Return Value

The result of evaluating the receiver as a string expression.

Discussion

Equivalent to calling [MBExpression asString:] with the receiver as the parameter.

Declared In

MBExpressionExtensions.h

– evaluateAsNumber

Evaluates the receiver as an expression returning a numeric value.

- (nullable NSDecimalNumber *)evaluateAsNumber

Return Value

The result of evaluating the receiver as a numeric expression.

Discussion

Equivalent to calling [MBExpression asNumber:] with the receiver as the parameter.

Declared In

MBExpressionExtensions.h

– evaluateAsBoolean

Evaluates the receiver as an expression returning a boolean value.

- (BOOL)evaluateAsBoolean

Return Value

The result of evaluating the receiver as a boolean expression.

Discussion

Equivalent to calling [MBExpression asBoolean:] with the receiver as the parameter.

Declared In

MBExpressionExtensions.h

– asVariableExpression

Returns an expression usable for referencing the MBML variable whose name is contained in the receiver.

- (nonnull NSString *)asVariableExpression

Return Value

A Mockingbird expression usable for referencing the variable named by the receiver.

Discussion

If the receiver contains the text “user”, this method will return the value “$user”.

More complicated variable names will be returned in the correct form. For example, if the receiver contains the text “total$”, this method will return “$[total$]”.

Declared In

MBExpressionExtensions.h