Sprocket.Text.Explode
1.0.0
dotnet add package Sprocket.Text.Explode --version 1.0.0
NuGet\Install-Package Sprocket.Text.Explode -Version 1.0.0
<PackageReference Include="Sprocket.Text.Explode" Version="1.0.0" />
paket add Sprocket.Text.Explode --version 1.0.0
#r "nuget: Sprocket.Text.Explode, 1.0.0"
// Install Sprocket.Text.Explode as a Cake Addin #addin nuget:?package=Sprocket.Text.Explode&version=1.0.0 // Install Sprocket.Text.Explode as a Cake Tool #tool nuget:?package=Sprocket.Text.Explode&version=1.0.0
Created by David Pullin
Readme Last Updated on 12.02.2021
The full API can be found at https://ict-man.me/sprocket/api/Sprocket.Text.Explode.html
Licence GPL-3.0 License
Source code is hosted on GitHub here: https://github.com/david-pullin/ascii-calendar
Summary
Explode provides an extension function to the String class to split strings via a specified character or string. Useful for processing Comma Delimited (CSV) content.
Support is provided for text delimiters, for example, file that make use of the " character enclose strings that contain the field separator.
Examples
Namespace: Sprocket.Text.Explode
Example with default field delimiters
string s = "one,\"two.1,two.2\",three";
var sr = s.Explode(new ExplodeOptions());
List<string> sl = sr.Cells.ToStringList();
Assert.Equal(3, sl.Count);
Assert.Equal("one", sl[0]);
Assert.Equal("two.1,two.2", sl[1]);
Assert.Equal("three", sl[2]);
Example with a multiple character field delimiter
string s = "one_x_two_x_three";
var delim = new Delimiters("_x_");
var opts = new ExplodeOptions();
opts.Delimiters = delim;
var sr = s.Explode(opts);
List<string> sl = sr.Cells.ToStringList();
Assert.Equal(3, sl.Count);
Assert.Equal("one", sl[0]);
Assert.Equal("two", sl[1]);
Assert.Equal("three", sl[2]);
Note: The full API can be found at https://ict-man.me/sprocket/api/Sprocket.Text.Explode.html
ExplodeOptions Class
Namespace: Sprocket.Text.Explode
Properties
Name | Type | Default | Summary |
---|---|---|---|
EnableTextDelimiter | bool | true | Enables the processing of Text Delimiters. When enabled, Explode will process instances of the specified Delimiters.TextDelimiter to signify that any enclosed Delimiters.FieldDelimiter are taken as content. |
StrictTextDelimiterPositioning | bool | true | When enabled it is expected that the Delimiters.TextDelimiter (if present), it is positioned at then beginning and end of each field. If disabled, any Delimiters.TextDelimiter will be processed as a delimiter regardless of its position. |
StrictTextDelimiterPositioning AllowLeadingTrailingSpaces | bool | true | When enabled will allow for leading and trailing spaces before and after the Text Delimiters. |
AllowInsideDoubleTextDelimiters | bool | true | When enabled, and when containted within text delimiters, allows for double instances of the Delimiters.TextDelimiter to be processed as single instance content. |
Delimiters | Delimiters | , and " | Which character or strings are being used for Field and Text Delimiters. |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net5.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 351 | 2/12/2021 |