Table of Contents

Class VBStringValue

Namespace
RDCore.SDK.Model.Values.Intrinsic
Assembly
RDCore.SDK.dll

Represents and holds a String value.

public record VBStringValue : VBTypedValue, IEquatable<VBTypedValue>, IVBTypedValue<VBStringValue, string>, IEquatable<IVBTypedValue<VBStringValue, string>>, IEquatable<VBStringValue>
Inheritance
VBStringValue
Implements
Derived
Inherited Members

Constructors

VBStringValue(IBindingHandle)

Creates a new VBStringValue.

public VBStringValue(IBindingHandle handle)

Parameters

handle IBindingHandle

VBStringValue(string)

Creates a new VBStringValue.

public VBStringValue(string value)

Parameters

value string

Fields

NaN

Defined in MS-VBAL 5.5.1.2.4 Let-coercion to and from String.

public const string NaN = "1.#IND"

Field Value

string

Remarks

Does not appear to be actually implemented in MS-VBA. This token is actually specified as "-1.#IND", but given the apparent typographical error in the negative infinity specification, the specified negation prefix present in this token is deemed to have been intended for the negative infinity token instead.

NegativeInfinity

Defined in MS-VBAL 5.5.1.2.4 Let-coercion to and from String.

public const string NegativeInfinity = "-1.#INF"

Field Value

string

Remarks

Does not appear to be actually implemented in MS-VBA, but is explicitly specified as having the literal same string value as PositiveInfinity. Given the presence of transcription errors elsewhere and that this looks like one, the token is defined here with a negation prefix that distinguishes the two infinity types, as was probably intended - inferred from the presence of separate specifications for positive and negative infinity.

PositiveInfinity

Defined in MS-VBAL 5.5.1.2.4 Let-coercion to and from String.

public const string PositiveInfinity = "1.#INF"

Field Value

string

Remarks

Does not appear to be actually implemented in MS-VBA.

Zero

public const string Zero = "0"

Field Value

string

Properties

IsNullString

Whether this is vbNullString — a String bound to a null pointer rather than to a zero-length string.

public bool IsNullString { get; }

Property Value

bool

Remarks

The only observable difference between the two in MS-VBA is the pointer: vbNullString = "" is True and Len(vbNullString) is 0, but a null pointer occupies no string storage, which is what Size reports and this tells it.

Length

public virtual int Length { get; }

Property Value

int

Size

The allocated size (in bytes) of this value.

public override int Size { get; }

Property Value

int

VBNullString

Gets the static value of vbNullString.

public static VBStringValue VBNullString { get; }

Property Value

VBStringValue

Value

Gets the underlying managed value corresponding to this typed value.

public string Value { get; }

Property Value

string

ZeroLengthString

Gets the static value of the zero-length empty string.

public static VBStringValue ZeroLengthString { get; }

Property Value

VBStringValue

Methods

Equals(IVBTypedValue<VBStringValue, string>?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(IVBTypedValue<VBStringValue, string>? other)

Parameters

other IVBTypedValue<VBStringValue, string>

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

FromLiteralToken(string)

Creates a VBStringValue from the source text of a MS-VBAL 3.3.4 <STRING> token — the literal as it is spelled in source, delimiters included.

public static VBStringValue FromLiteralToken(string token)

Parameters

token string

The token's source text. Leading and trailing double-quote delimiters are removed when present; text carrying none is taken as-is, so a caller holding an already-unquoted value can pass it through without first having to tell the two apart.

Returns

VBStringValue

Remarks

MS-VBAL 3.3.4: "a sequence of two <double-quote> characters represents a single occurrence of the character U+0022 within the data value" — a literal's data value is therefore never its source text, and slicing off the delimiters alone leaves every embedded quote doubled.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

UnquoteLiteralToken(string)

Gets the data value (MS-VBAL 2.1) of a MS-VBAL 3.3.4 <STRING> token from its source text.

public static string UnquoteLiteralToken(string token)

Parameters

token string

The token's source text. Leading and trailing double-quote delimiters are removed when present; text carrying none is taken as-is.

Returns

string

Remarks

The string counterpart of FromLiteralToken(string), for callers that need the data value itself rather than a value bound to it.

WithValue(string?)

public virtual VBStringValue WithValue(string? value)

Parameters

value string

Returns

VBStringValue