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>)
public static string[] Split(string value, Action<DelimitedStringOptions> setup = null)
Parameters
valuestringThe delimited string to split.
setupAction<DelimitedStringOptions>The DelimitedStringOptions which may be configured.
Returns
Remarks
The default implementation conforms to RFC 4180.
This implementation was inspired by the following Stack Overflow discussions:
- https://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
- https://stackoverflow.com/questions/6542996/how-to-split-csv-whose-columns-may-contain
Exceptions
- ArgumentException
valueis null, empty, or consists only of white-space characters.- InvalidOperationException
Thrown when
valuecannot be split using the configured Delimiter and Qualifier. This typically indicates malformed input, such as an unclosed qualified field.