Table of Contents

Class VBFixedStringType

Namespace
RDCore.SDK.Model.Types
Assembly
RDCore.SDK.dll

A VBStringType representing the String*length (fixed-length String) data type.

public sealed record VBFixedStringType : VBStringType, IEquatable<VBType>, IEquatable<VBIntrinsicType>, IEquatable<VBIntrinsicType<string?>>, IEquatable<VBStringType>, IEquatable<VBFixedStringType>
Inheritance
VBFixedStringType
Implements
Inherited Members
Extension Methods

Remarks

👉 Fixed-length strings are padded (with spaces) or truncated as needed to meet the specified declared length.

Constructors

VBFixedStringType(int)

A VBStringType representing the String*length (fixed-length String) data type.

public VBFixedStringType(int Length)

Parameters

Length int

The length of the string value.

Remarks

👉 Fixed-length strings are padded (with spaces) or truncated as needed to meet the specified declared length.

Fields

MaxWrittenLength

The largest number a length can be written as, as a literal: one past it is no length at all (MS-VBA: "Syntax error", Excel-verified).

public const int MaxWrittenLength = 65535

Field Value

int

Properties

DefaultValue

A string of Length null characters (U+0000): the initial value of a fixed-length string variable (MS-VBAL 2.3).

public override VBTypedValue DefaultValue { get; }

Property Value

VBTypedValue

Length

The length of the string value.

public int Length { get; init; }

Property Value

int

MaxLength

MS-VBAL 2.2 Entities and Data Types restricts the maximum length of a fixed-length string to 65,526 characters.

public static int MaxLength { get; }

Property Value

int

Methods

IsValidLength(long)

Whether a fixed-length string can be length characters long: from 1 to MaxLength (MS-VBA: "Invalid length for fixed-length string" otherwise, Excel-verified).

public static bool IsValidLength(long length)

Parameters

length long

The length, Let-coerced to Long.

Returns

bool

TryParseLengthLiteral(string, out long)

Reads a length written as a literal (MS-VBAL §5.2.3.1.4 <string-length>, an INTEGER): decimal, &H hexadecimal or &O octal, with or without a type-declaration character.

public static bool TryParseLengthLiteral(string text, out long length)

Parameters

text string

The length as written.

length long

The number it is.

Returns

bool

false when the text is no integer literal: 1.5, or a name.