Class VBFixedStringType
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
LengthintThe 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
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
Length
The length of the string value.
public int Length { get; init; }
Property Value
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
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
lengthlongThe length, Let-coerced to
Long.
Returns
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)