Show / Hide Table of Contents

Class DelimitedString

Provides a set of static methods to convert a sequence into a delimited string and break a delimited string into substrings.

Inheritance
Object
DelimitedString
Namespace: Cuemon
Assembly: Cuemon.Core.dll
Syntax
public static class DelimitedString

Methods

| Improve this Doc View Source

Create<T>(IEnumerable<T>, Action<DelimitedStringOptions<T>>)

Creates a delimited string representation from the specified source.

Declaration
public static string Create<T>(IEnumerable<T> source, Action<DelimitedStringOptions<T>> setup = null)
Parameters
Type Name Description
IEnumerable<T> source

The IEnumerable<T> to convert.

Action<DelimitedStringOptions<T>> setup

The DelimitedStringOptions<T> which may be configured.

Returns
Type Description
String

A String of delimited values that is a result of source.

Type Parameters
Name Description
T
Exceptions
Type Condition
ArgumentNullException

source cannot be null.

| Improve this Doc View Source

Split(String, Action<DelimitedStringOptions>)

Returns a string[] that contain the substrings of value delimited by a Delimiter that may be quoted by Qualifier.

Declaration
public static string[] Split(string value, Action<DelimitedStringOptions> setup = null)
Parameters
Type Name Description
String value

The value containing substrings and delimiters.

Action<DelimitedStringOptions> setup

The DelimitedStringOptions which may be configured.

Returns
Type Description
String[]

A string[] that contain the substrings of value delimited 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
Type Condition
InvalidOperationException

An error occurred while splitting value into 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.

  • Improve this Doc
  • View Source
In This Article
Back to top Copyright 2008-2022 Geekle. All rights reserved. Code with passion and love; deploy with confidence. 👨‍💻️🔥❤️🚀😎
Generated by DocFX