Skip to main content

SalString

Namespace: PPJ.Runtime

Assembly: PPJ.Runtime.50 (5.0.0.0)

Represents a SAL string or binary buffer, with SAL null semantics and implicit conversions to and from String.

public class SalString : IComparable, IConvertible, IFormattable, INullable, ISalType, IXmlSerializable

A null value is a SalString instance whose IsNull property is true; it is distinct from a null object reference. Both null and empty values satisfy IsEmpty.

Text constructors retain the entire string. Byte-array constructors store one byte per character and set Length to the first zero byte. Use Value for the full character buffer and GetBlob for its bytes; ToString returns only the text portion of a blob.

String operations generally return a result without changing this instance. Overloads with a reference parameter replace the caller's variable. IsBlob is writable, so instances, including the shared null and empty values, should not be treated as immutable.

Example:

using PPJ.Runtime;

SalString name = " Ada Lovelace ";
SalString displayName = name.Trim();
string text = displayName; // "Ada Lovelace"
SalString firstName = displayName.Left(3); // "Ada"

SalString missing = (string)null;
bool isMissing = missing.IsNull; // true
string missingText = missing; // string.Empty

SalString data = new SalString(new byte[] { 65, 0, 66 });
string prefix = data.ToString(); // "A"
byte[] bytes = data.GetBlob(); // { 65, 0, 66 }

Constructors

Instance member SalString()

Initializes a new instance containing a non-null empty text string.

Instance member SalString(x)

Initializes a new instance with the specified text.

NameTypeDescription
xStringThe text to wrap, or for a SAL null value.

Embedded zero characters are retained and included in Length.

Instance member SalString(chars)

Initializes a new text instance from a character array.

NameTypeDescription
charsChar[]The characters to copy, or for an empty string.

Instance member SalString(chars, index, length)

Initializes a new text instance from a range of characters.

NameTypeDescription
charsChar[]The array containing the characters to copy.
indexInt32The zero-based index of the first character.
lengthInt32The number of characters to copy.

Throws:

Instance member SalString(blob)

Initializes a new binary instance from the supplied bytes.

NameTypeDescription
blobByte[]The bytes to copy, or for a SAL null blob.

Each byte is stored as one character. Length stops at the first zero byte; GetBlob preserves the full buffer.

Instance member SalString(blob, index, length)

Initializes a binary buffer using the specified source and buffer indices.

NameTypeDescription
blobByte[]The source bytes, or for a SAL null blob.
indexInt32The zero-based source and destination index at which copying starts.
lengthInt32The destination buffer length and exclusive upper source index.

This overload copies indices from index through length minus one into the same positions in a buffer of length characters. Positions before index remain zero. The length is not a count of bytes starting at the index.

Fields

NameTypeDescriptionValue
EmptySalStringRepresents a shared, non-null empty text value.
NullSalStringRepresents a shared SAL null text value.
NullBlobSalStringRepresents a shared SAL null binary value.

Properties

Instance member IsBlob

Boolean: Gets or sets whether this instance is treated as a binary buffer.

Changing this flag does not convert the buffer or recalculate Length.

Instance member IsEmpty

Boolean: Gets whether the full wrapped buffer is null or empty.

A nonempty buffer beginning with a zero character is not empty, even if Length is zero.

Instance member IsNull

Boolean: Gets whether the wrapped value is null.

Instance member Item(index)

Char: Gets a character from the full underlying buffer.

The index addresses Value, including any characters beyond Length. Throws:

Instance member Length

SalNumber: Gets the recorded character length.

For a byte-array value, the length stops at the first zero byte. For ordinary text it includes embedded zero characters. Padding added by SetBufferLength is excluded.

Instance member Value

String: Gets the full underlying character buffer.

Methods

Instance member Clone()

Creates a separate instance with the same buffer, recorded length, and blob flag.

Returns: SalString. A new instance containing the same value and metadata.

Static member Compare(x, y)

Compares two SAL values using ordinal, case-sensitive text ordering.

ParameterTypeDescription
xSalStringThe left value, or .
ySalStringThe right value, or .

Returns: Int32. A negative value if the left value precedes the right value, zero if they compare equal, or a positive value if it follows the right value.

A null object reference sorts before any instance. Non-null instances are compared through their string conversions, so SAL null and empty text values compare equal; blob text ends at its recorded Length.

Instance member CompareTo(obj)

Compares this value with a SAL string or a .NET string.

ParameterTypeDescription
objObjectThe value to compare with this instance, or .

Returns: Int32. A negative value, zero, or a positive value when this instance precedes, equals, or follows the argument.

SAL operands use Compare. Other operands are passed to the wrapped string's culture-sensitive comparison. A SAL null instance compares equal to a null argument and precedes any non-null argument. Throws:

  • ArgumentException The wrapped value is non-null and the argument is neither a string, a SalString, nor null.

Instance member CompareTo(x)

Compares this instance with another SAL value using ordinal text ordering.

ParameterTypeDescription
xSalStringThe value to compare with this instance, or .

Returns: Int32. A negative value, zero, or a positive value when this instance precedes, equals, or follows the argument.

Uses Compare.

Instance member Compress()

Compresses the UTF-8 representation of the full wrapped string using the SAL compression format.

Returns: SalString. A blob containing the compressed bytes and SAL compression header.

Use Uncompress to restore the text. Throws:

Instance member Compress(sRet)

Compresses the UTF-8 representation of the full wrapped string using the SAL compression format.

ParameterTypeDescription
sRet by referenceSalStringWhen this method returns, contains the resulting string. The previous value is replaced.

Returns: Boolean. True after the compressed value has been assigned.

Use Uncompress to restore the text. Throws:

Static member Concat(x, y)

Concatenates two SAL string values.

ParameterTypeDescription
xSalStringThe left value. Must not be a null object reference.
ySalStringThe right value. Must not be a null object reference.

Returns: SalString. The other operand when either operand is null-valued or empty; otherwise, a new text instance containing both full buffers.

When both operands are null-valued or empty, the right operand is returned. A newly constructed result is not marked as a blob.

Static member FirstChar(target, charCode)

Consumes the first character or simulated terminator from the supplied value.

ParameterTypeDescription
target by referenceSalStringThe value to consume. Replaced with the remainder, or a null blob after the simulated terminator.
charCode by referenceSalNumberReceives the UTF-16 character code, or zero for the simulated terminator. Unchanged if no character is available.

Returns: Boolean. True when a character or simulated terminator was consumed; false when the buffer size was zero.

Uses Lop. The target must not be a null object reference.

Static member FreeHandle(handle)

Releases one reference acquired for a string handle.

ParameterTypeDescription
handleIntPtrThe handle to release. A zero handle is ignored.

The registry entry is removed when its reference count reaches zero. Throws:

  • InvalidOperationException The nonzero handle is not registered, including a handle whose references have already been released.

Static member FromHandle(handle, free)

Retrieves the string registered for a handle.

ParameterTypeDescription
handleIntPtrThe handle returned by ToHandle.
free optionalBooleanTrue to release one acquired reference after retrieving the value; false to keep it.

Returns: SalString. The registered instance, or Null if the handle is zero or is no longer registered.

Static member FromHandleOnce(handle)

Retrieves a registered string and releases one reference to its handle.

ParameterTypeDescription
handleIntPtrThe handle returned by ToHandle.

Returns: SalString. The registered instance, or Null for a zero or unregistered handle.

Example:

using PPJ.Runtime;

SalString message = "Ready";
System.IntPtr handle = message.ToHandle(); // Acquire one reference.
SalString restored = SalString.FromHandleOnce(handle); // "Ready"
// The acquired reference has been released; do not call FreeHandle for it again.

Static member FromHex(hex)

Decodes hexadecimal byte pairs into a binary SAL value.

ParameterTypeDescription
hexStringThe hexadecimal byte pairs, optionally preceded by the lowercase prefix 0x.

Returns: SalString. The decoded blob, or NullBlob when the input is null or shorter than two characters.

Use an even number of hexadecimal digits. Letter digits may be uppercase or lowercase. The method does not validate that every character is a hexadecimal digit. Throws:

Instance member GetBlob()

Copies the low byte of every character in the full buffer.

Returns: Byte[]. A new byte array, or an empty array for a null or empty value.

Includes data after zero characters and any buffer padding. This method does not perform a text-encoding conversion.

Instance member GetBufferLength()

Returns the full buffer size, including the simulated terminator for text values.

Returns: SalNumber. The underlying string length for a blob, or that length plus one for text. A null blob has size zero; a null text value has size one.

Instance member IsValidCurrency(precision, scale)

Determines whether the string can be parsed as a currency value within the specified precision and scale.

ParameterTypeDescription
precisionInt32The total permitted decimal precision. The absolute value must be less than 10 raised to precision minus scale.
scaleInt32The maximum permitted number of fractional decimal places.

Returns: Boolean. True if parsing and validation succeed; false for null, empty, or invalid input.

Uses currency parsing rules and validates digit grouping.

Instance member IsValidCurrency(precision, scale, provider)

Determines whether the string can be parsed as a currency value within the specified precision and scale.

ParameterTypeDescription
precisionInt32The total permitted decimal precision. The absolute value must be less than 10 raised to precision minus scale.
scaleInt32The maximum permitted number of fractional decimal places.
providerIFormatProviderThe culture-specific formatting information, or to use the default parsing culture.

Returns: Boolean. True if parsing and validation succeed; false for null, empty, or invalid input.

Uses currency parsing rules and validates digit grouping.

Instance member IsValidCurrency(precision, scale, format, provider)

Determines whether the string can be parsed as a currency value within the specified precision and scale.

ParameterTypeDescription
precisionInt32The total permitted decimal precision. The absolute value must be less than 10 raised to precision minus scale.
scaleInt32The maximum permitted number of fractional decimal places.
formatStringThe numeric format used to remove formatting text before parsing, or or an empty string for unformatted parsing.
providerIFormatProviderThe culture-specific formatting information, or to use the default parsing culture.

Returns: Boolean. True if parsing and validation succeed; false for null, empty, or invalid input.

Uses currency parsing rules and validates digit grouping.

Instance member IsValidDateTime()

Determines whether the string can be parsed as a date/time value.

Returns: Boolean. True if parsing and validation succeed; false for null, empty, or invalid input.

Uses ToDate, including its fallback parsing rules.

Instance member IsValidDateTime(provider)

Determines whether the string can be parsed as a date/time value.

ParameterTypeDescription
providerIFormatProviderThe culture-specific formatting information, or to use the default parsing culture.

Returns: Boolean. True if parsing and validation succeed; false for null, empty, or invalid input.

Uses ToDate, including its fallback parsing rules.

Instance member IsValidDateTime(format, provider)

Determines whether the string can be parsed as a date/time value.

ParameterTypeDescription
formatStringThe preferred date/time format, or or an empty string to use default parsing.
providerIFormatProviderThe culture-specific formatting information, or to use the default parsing culture.

Returns: Boolean. True if parsing and validation succeed; false for null, empty, or invalid input.

Uses ToDate, including its fallback parsing rules.

Instance member IsValidDecimal(precision, scale)

Determines whether the string can be parsed as a decimal value within the specified precision and scale.

ParameterTypeDescription
precisionInt32The total permitted decimal precision. The absolute value must be less than 10 raised to precision minus scale.
scaleInt32The maximum permitted number of fractional decimal places.

Returns: Boolean. True if parsing and validation succeed; false for null, empty, or invalid input.

Uses decimal parsing with currency and exponent notation and validates digit grouping.

Instance member IsValidDecimal(precision, scale, provider)

Determines whether the string can be parsed as a decimal value within the specified precision and scale.

ParameterTypeDescription
precisionInt32The total permitted decimal precision. The absolute value must be less than 10 raised to precision minus scale.
scaleInt32The maximum permitted number of fractional decimal places.
providerIFormatProviderThe culture-specific formatting information, or to use the default parsing culture.

Returns: Boolean. True if parsing and validation succeed; false for null, empty, or invalid input.

Uses decimal parsing with currency and exponent notation and validates digit grouping.

Instance member IsValidDecimal(precision, scale, format, provider)

Determines whether the string can be parsed as a decimal value within the specified precision and scale.

ParameterTypeDescription
precisionInt32The total permitted decimal precision. The absolute value must be less than 10 raised to precision minus scale.
scaleInt32The maximum permitted number of fractional decimal places.
formatStringThe numeric format used to remove formatting text before parsing, or or an empty string for unformatted parsing.
providerIFormatProviderThe culture-specific formatting information, or to use the default parsing culture.

Returns: Boolean. True if parsing and validation succeed; false for null, empty, or invalid input.

Uses decimal parsing with currency and exponent notation and validates digit grouping.

Instance member IsValidIdentifierName()

Determines whether the string follows the SAL identifier character rules.

Returns: Boolean. True if the first character is a letter or underscore and subsequent characters are letters, digits, or underscores; otherwise, false.

Uses Unicode letter and digit classification. Null and empty values are invalid. This method does not check reserved words.

Instance member IsValidInteger()

Determines whether the string can be parsed as a number with no fractional part.

Returns: Boolean. True if parsing and validation succeed; false for null, empty, or invalid input.

Uses decimal parsing rather than a fixed-width integer range. Currency and exponent notation are accepted if the result has no fractional part.

Instance member IsValidInteger(format)

Determines whether the string can be parsed as a number with no fractional part.

ParameterTypeDescription
formatStringThe numeric format used to remove formatting text before parsing, or or an empty string for unformatted parsing.

Returns: Boolean. True if parsing and validation succeed; false for null, empty, or invalid input.

Uses decimal parsing rather than a fixed-width integer range. Currency and exponent notation are accepted if the result has no fractional part.

Instance member IsValidNumber()

Determines whether the string can be parsed as a decimal number.

Returns: Boolean. True if parsing and validation succeed; false for null, empty, or invalid input.

Uses decimal parsing with currency and exponent notation and validates digit grouping.

Instance member IsValidNumber(provider)

Determines whether the string can be parsed as a decimal number.

ParameterTypeDescription
providerIFormatProviderThe culture-specific formatting information, or to use the default parsing culture.

Returns: Boolean. True if parsing and validation succeed; false for null, empty, or invalid input.

Uses decimal parsing with currency and exponent notation and validates digit grouping.

Instance member IsValidNumber(format, provider)

Determines whether the string can be parsed as a decimal number.

ParameterTypeDescription
formatStringThe numeric format used to remove formatting text before parsing, or or an empty string for unformatted parsing.
providerIFormatProviderThe culture-specific formatting information, or to use the default parsing culture.

Returns: Boolean. True if parsing and validation succeed; false for null, empty, or invalid input.

Uses decimal parsing with currency and exponent notation and validates digit grouping.

Instance member Left(length)

Returns the leading characters of the string.

ParameterTypeDescription
lengthInt32The requested character count, clamped to zero through Length.

Returns: SalString. The requested prefix, or an empty string for a null or empty value.

Instance member Left(length, target)

Returns the leading characters of the string. Assigns the result to the target.

ParameterTypeDescription
lengthInt32The requested character count, clamped to zero through Length.
target by referenceSalStringWhen this method returns, contains the resulting string. The previous value is replaced.

Returns: SalNumber. The number of characters in the resulting string.

Instance member Lop(target)

Returns the first character code and assigns the remaining full buffer to the target.

ParameterTypeDescription
target by referenceSalStringReceives the string without its first character, or a null blob when consuming the simulated terminator. Unchanged if the buffer size is zero.

Returns: SalNumber. The first UTF-16 character code; zero for the simulated terminator of an empty text value; or -1 when the buffer size is zero.

Instance member Mid(pos, length)

Returns a substring within the recorded string length.

ParameterTypeDescription
posInt32The zero-based starting position, clamped to zero through Length.
lengthInt32The requested character count. Negative values become zero; values beyond the end are shortened.

Returns: SalString. The requested substring, or an empty string when no characters are selected.

Instance member Mid(pos, length, target)

Returns a substring within the recorded string length. Assigns the result to the target.

ParameterTypeDescription
posInt32The zero-based starting position, clamped to zero through Length.
lengthInt32The requested character count. Negative values become zero; values beyond the end are shortened.
target by referenceSalStringWhen this method returns, contains the resulting string. The previous value is replaced.

Returns: SalNumber. The number of characters in the resulting string.

Instance member Repeat(times)

Concatenates the full buffer with itself the specified number of times.

ParameterTypeDescription
timesInt32The repetition count. Values less than one produce an empty string.

Returns: SalString. The repeated string, or an empty string for a null value or zero recorded length.

Instance member Repeat(times, target)

Concatenates the full buffer with itself the specified number of times. Assigns the result to the target.

ParameterTypeDescription
timesInt32The repetition count. Values less than one produce an empty string.
target by referenceSalStringWhen this method returns, contains the resulting string. The previous value is replaced.

Returns: SalNumber. The number of characters in the resulting string.

Instance member Replace(startPos, length, replace)

Replaces a range of characters with the specified text.

ParameterTypeDescription
startPosInt32The zero-based starting position, clamped to zero through Length.
lengthInt32The number of characters to remove, clamped to the available recorded length.
replaceStringThe replacement text, or to remove the selected range.

Returns: SalString. The resulting text, or an empty string if this value is SAL null.

A zero removal length inserts text. A position at or beyond Length inserts at that position after clamping.

Instance member Replace(startPos, length, replace, target)

Replaces a range of characters with the specified text. Assigns the result to the target.

ParameterTypeDescription
startPosInt32The zero-based starting position, clamped to zero through Length.
lengthInt32The number of characters to remove, clamped to the available recorded length.
replaceStringThe replacement text, or to remove the selected range.
target by referenceSalStringWhen this method returns, contains the resulting string. The previous value is replaced.

Returns: SalNumber. The number of characters in the resulting string.

A zero removal length inserts text. A position at or beyond Length inserts at that position after clamping.

Instance member Right(length)

Returns the trailing characters within the recorded string length.

ParameterTypeDescription
lengthInt32The requested character count, clamped to zero through Length.

Returns: SalString. The requested suffix, or an empty string for a null or empty value.

Instance member Right(length, target)

Returns the trailing characters within the recorded string length. Assigns the result to the target.

ParameterTypeDescription
lengthInt32The requested character count, clamped to zero through Length.
target by referenceSalStringWhen this method returns, contains the resulting string. The previous value is replaced.

Returns: SalNumber. The number of characters in the resulting string.

Instance member Scan(pattern)

Searches the string using SAL wildcard matching.

ParameterTypeDescription
patternStringThe search pattern. Use % for a sequence, _ for one character, and a backslash to escape the next character.

Returns: SalNumber. The zero-based match offset, or -1 when no match is found. Returns zero when both the value and pattern are null or empty.

Matching ignores case using current-culture character casing.

Instance member SetBufferLength(length)

Produces a string with the requested underlying buffer length.

ParameterTypeDescription
lengthInt32The requested buffer length. Zero or negative values produce an empty string.

Returns: SalString. The original instance if the buffer already has the requested positive length; otherwise, the resized text value.

Shorter buffers are truncated. Longer buffers are padded with zero characters while Length records the original full buffer length. Newly created results are text values, not blobs.

Instance member SetBufferLength(target, length)

Produces a string with the requested underlying buffer length.

ParameterTypeDescription
target by referenceSalStringWhen this method returns, contains the resulting string. The previous value is replaced.
lengthInt32The requested buffer length. Zero or negative values produce an empty string.

Returns: Boolean. True after the result has been assigned.

Shorter buffers are truncated. Longer buffers are padded with zero characters while Length records the original full buffer length. Newly created results are text values, not blobs.

Instance member ToDate()

Parses the string as a date/time value.

Returns: SalDateTime. The parsed value, or Null for null, empty, or unparseable input.

Parsing tries the supplied format when present, then general date parsing, built-in SAL formats, and the default SAL long format. The format is a preference, not a strict validation mask. SAL S and L select short and long dates; hhhh, AMPM, and mmmmmm map to 24-hour hours, a designator, and fractional seconds.

Instance member ToDate(format)

Parses the string as a date/time value.

ParameterTypeDescription
formatStringThe preferred date/time format, including supported SAL placeholders, or or an empty string for default parsing.

Returns: SalDateTime. The parsed value, or Null for null, empty, or unparseable input.

Parsing tries the supplied format when present, then general date parsing, built-in SAL formats, and the default SAL long format. The format is a preference, not a strict validation mask. SAL S and L select short and long dates; hhhh, AMPM, and mmmmmm map to 24-hour hours, a designator, and fractional seconds.

Instance member ToDate(format, provider)

Parses the string as a date/time value.

ParameterTypeDescription
formatStringThe preferred date/time format, including supported SAL placeholders, or or an empty string for default parsing.
providerIFormatProviderThe culture-specific formatting information, or to use the default parsing culture.

Returns: SalDateTime. The parsed value, or Null for null, empty, or unparseable input.

Parsing tries the supplied format when present, then general date parsing, built-in SAL formats, and the default SAL long format. The format is a preference, not a strict validation mask. SAL S and L select short and long dates; hhhh, AMPM, and mmmmmm map to 24-hour hours, a designator, and fractional seconds.

Instance member ToHandle()

Acquires a reference-counted handle for this string value.

Returns: IntPtr. A handle registered for the full string value, or Zero for a SAL null value.

Equal underlying strings share a handle. Each call for a non-null value acquires a reference that must be released by FreeHandle or FromHandleOnce. The handle is a registry identifier, not a native memory address.

Example:

using PPJ.Runtime;

SalString message = "Ready";
System.IntPtr handle = message.ToHandle();
try
{
SalString restored = SalString.FromHandle(handle);
}
finally
{
SalString.FreeHandle(handle);
}

Instance member ToHex()

Encodes the full buffer as uppercase hexadecimal byte pairs.

Returns: String. Two hexadecimal digits per byte, without a prefix, or an empty string for a null or empty buffer.

Uses GetBlob, so only the low eight bits of each character are encoded.

Instance member Tokenize(startDel, endDel)

Splits the full string into tokens using sets of delimiter characters.

ParameterTypeDescription
startDelStringCharacters to skip before each token. Use an empty string to skip none.
endDelStringCharacters that end a token. Use an empty string to read to the end.

Returns: SalArray<SalString>. A new array of tokens, or an empty array for a null or empty value.

Delimiters are sets of individual characters, not multi-character markers. Empty tokens can be produced. Delimiter arguments must not be null for nonempty input.

Example:

using PPJ.Runtime;

SalString text = "Ada,,Grace;Linus";
SalArray<SalString> fields = text.Tokenize("", ",;");
// fields: "Ada", "", "Grace", "Linus".

SalArray<SalString> names = text.Tokenize(",;", ",;");
// names: "Ada", "Grace", "Linus".
// Both ',' and ';' are individual delimiters, not a two-character separator.

Instance member Tokenize(startDel, endDel, target)

Splits the full string into tokens using sets of delimiter characters.

ParameterTypeDescription
startDelStringCharacters to skip before each token. Use an empty string to skip none.
endDelStringCharacters that end a token. Use an empty string to read to the end.
targetSalArray<SalString>The array that receives tokens starting at its lower bounds. Existing elements beyond the copied tokens are retained.

Returns: SalNumber. The number of tokens copied.

Delimiters are sets of individual characters, not multi-character markers. Empty tokens can be produced. Delimiter arguments must not be null for nonempty input. If tokens are found, the target is made dynamic; if none are found, it is left unchanged.

Example:

using PPJ.Runtime;

SalArray<SalString> target = new SalArray<SalString>();
target.Add("old first");
target.Add("old second");
target.Add("retained");

SalString text = "Ada,Grace";
SalNumber copied = text.Tokenize("", ",", target); // 2
// target now contains "Ada", "Grace", "retained".
// Use the returned count when processing just the newly copied tokens.

Instance member ToLower()

Converts the full string to lowercase using the current culture.

Returns: SalString. The lowercase text, or an empty string for a null or empty value.

Instance member ToLower(target)

Converts the full string to lowercase using the current culture. Assigns the result to the target.

ParameterTypeDescription
target by referenceSalStringWhen this method returns, contains the resulting string. The previous value is replaced.

Returns: SalNumber. The number of characters in the resulting string.

Instance member ToNumber()

Parses the string as a decimal number.

Returns: SalNumber. The parsed value, or Zero for null, empty, or unparseable input.

Supports currency symbols, exponents, parentheses for negative values, and validated digit grouping. Formatted parsing, when requested, is followed by unformatted parsing.

Example:

using PPJ.Runtime;

SalString input = "not a number";
SalNumber fallback = input.ToNumber(); // Zero
SalNumber nullable = input.ToNumber(null); // SalNumber.Null

Instance member ToNumber(format)

Parses the string as a decimal number.

ParameterTypeDescription
formatStringThe numeric format used to remove formatting text before parsing, or or an empty string for unformatted parsing.

Returns: SalNumber. The parsed value, or Null for null, empty, or unparseable input.

Supports currency symbols, exponents, parentheses for negative values, and validated digit grouping. Formatted parsing, when requested, is followed by unformatted parsing.

Instance member ToNumber(format, provider)

Parses the string as a decimal number.

ParameterTypeDescription
formatStringThe numeric format used to remove formatting text before parsing, or or an empty string for unformatted parsing.
providerIFormatProviderThe culture-specific formatting information, or to use the default parsing culture.

Returns: SalNumber. The parsed value, or Null for null, empty, or unparseable input.

Supports currency symbols, exponents, parentheses for negative values, and validated digit grouping. Formatted parsing, when requested, is followed by unformatted parsing.

Instance member ToProper()

Uppercases the first character and each character following whitespace, and lowercases other characters.

Returns: SalString. The converted text within Length, or an empty string for a null or empty value.

Uses the current culture. Punctuation does not start a new word.

Instance member ToProper(target)

Uppercases the first character and each character following whitespace, and lowercases other characters. Assigns the result to the target.

ParameterTypeDescription
target by referenceSalStringWhen this method returns, contains the resulting string. The previous value is replaced.

Returns: SalNumber. The number of characters in the resulting string.

Uses the current culture. Punctuation does not start a new word.

Instance member ToUpper()

Converts the full string to uppercase using the current culture.

Returns: SalString. The uppercase text, or an empty string for a null or empty value.

Instance member ToUpper(target)

Converts the full string to uppercase using the current culture. Assigns the result to the target.

ParameterTypeDescription
target by referenceSalStringWhen this method returns, contains the resulting string. The previous value is replaced.

Returns: SalNumber. The number of characters in the resulting string.

Instance member Trim()

Removes leading and trailing whitespace and collapses internal whitespace runs to a single space.

Returns: SalString. The normalized text, or an empty string for a null or empty value.

Carriage returns, line feeds, and nonbreaking spaces are preserved.

Instance member Trim(target)

Removes leading and trailing whitespace and collapses internal whitespace runs to a single space. Assigns the result to the target.

ParameterTypeDescription
target by referenceSalStringWhen this method returns, contains the resulting string. The previous value is replaced.

Returns: SalNumber. The number of characters in the resulting string.

Carriage returns, line feeds, and nonbreaking spaces are preserved.

Instance member Uncompress()

Decompresses a buffer in the SAL compression format.

Returns: SalString. The decompressed text, or an empty string for empty input, a short header, or an unrecognized header.

Restores text compressed by Compress. An empty result is not distinguished from rejected input.

Instance member Uncompress(target)

Decompresses a buffer in the SAL compression format.

ParameterTypeDescription
target by referenceSalStringReceives the decompressed text when the result is nonempty; otherwise, retains its previous value.

Returns: Boolean. True if a nonempty result was assigned; false if decompression returned an empty string.

Restores text compressed by Compress. An empty result is not distinguished from rejected input. A successfully decompressed empty string also returns false.

Inherited By

NameDescription
SalStringContextCarries a SAL context object together with its string representation.

Implements

NameDescription
ISalTypeExposes a SAL value in the form used for database parameter binding.