Class FormatStringError
The FormatStringParser exposes a List of these objects if errors exist in its current format string.
Inheritance
Namespace: WizardWrx.FormatStringEngine
Assembly: WizardWrx.FormatStringEngine.dll
Syntax
public class FormatStringError : object
Remarks
The only property that has any use outside the defining assembly is the string representation, which returns the properties in a well formed CSV string.
Likewise, only other classes defined in the same assembly are allowed to create instances of this object, which are immutable.
Fields
| Improve this Doc View SourceCOMMA_GUARD
Since some strings necessarily contain embedded commas, such commas must be protected. This is accomplished by enclosing the affected string in double quotation marks before it is appended.
Declaration
public const char COMMA_GUARD = null
Field Value
Type | Description |
---|---|
System.Char |
FIELD_DELIMITER
This constant is the field delimiter.
Declaration
public const char FIELD_DELIMITER = null
Field Value
Type | Description |
---|---|
System.Char |
LABEL_VALUE_DELIMITER
This constant delimits the field label from its value.
Declaration
public const char LABEL_VALUE_DELIMITER = null
Field Value
Type | Description |
---|---|
System.Char |
Methods
| Improve this Doc View SourceSplit()
Split the message into an array of parts, each containing a property value and its label.
Please see the remarks.
Declaration
public string[] Split()
Returns
Type | Description |
---|---|
System.String[] | The return value is an array of strings. Please see the remarks for essential information about this string. |
Remarks
This function is provided to facilitate correctly splitting a string, returned by the ToString method on an instance, into fields, each of which is a name/value pair that can be further subdivided, using the built-in string.Split method, along with LABEL_VALUE_DELIMITER, the correct delimiter to use with string.Split.
Under the covers, Split passes the string returned by a call to the instance ToString method to the static WizardWrx.AnyCSV.Parser.Parse method, which does most of the work.
IMPORTANT: Since the new version of WizardWrx.AnyCSV.dll has a COM interface, it had to target the x86 platform. This can eventually be corrected by building a parallel version that isn't exposed to COM.
ToString()
Format the properties into a comma-delimited string, which may be used as is or processed by the Split method on this instance.
Please see the remarks for essential information about this string.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | Please see the remarks for essential information about this string. |
Remarks
The standard string.Split method cannot split this string correctly, because it treats commas embedded in its strings as delimiters, thus splitting the string into too many pieces, and at the wrong places.
Use the Split method on this instance, which employs a robust CSV parsing engine that splits it correctly.