Class DelimitedString
- Namespace
- Cuemon
- Assembly
- Cuemon.Core.dll
Provides a set of static methods to convert a sequence into a delimited string and break a delimited string into substrings.
public static class DelimitedString- Inheritance
- 
      
      DelimitedString
Methods
Create<T>(IEnumerable<T>, Action<DelimitedStringOptions<T>>)
Creates a delimited string representation from the specified source.
public static string Create<T>(IEnumerable<T> source, Action<DelimitedStringOptions<T>> setup = null)Parameters
- sourceIEnumerable<T>
- The IEnumerable<T> to convert. 
- setupAction<DelimitedStringOptions<T>>
- The DelimitedStringOptions<T> which may be configured. 
Returns
Type Parameters
- T
Exceptions
- ArgumentNullException
- sourcecannot be null.
Split(string, Action<DelimitedStringOptions>)
Returns a string[] that contain the substrings of value delimited by a Delimiter that may be quoted by Qualifier.
public static string[] Split(string value, Action<DelimitedStringOptions> setup = null)Parameters
- valuestring
- The value containing substrings and delimiters. 
- setupAction<DelimitedStringOptions>
- The DelimitedStringOptions which may be configured. 
Returns
- string[]
- A string[] that contain the substrings of - valuedelimited by a Delimiter and optionally surrounded within Qualifier.
Remarks
This method was inspired by two articles on StackOverflow @ http://stackoverflow.com/questions/2807536/split-string-in-c-sharp, https://stackoverflow.com/questions/3776458/split-a-comma-separated-string-with-both-quoted-and-unquoted-strings and https://stackoverflow.com/questions/6542996/how-to-split-csv-whose-columns-may-contain. The default implementation conforms with the RFC-4180 standard.
Exceptions
- InvalidOperationException
- An error occurred while splitting - valueinto substrings separated by Delimiter and quoted with Qualifier. This is typically related to data corruption, eg. a field has not been properly closed with the Qualifier specified.