Skip to content

Commit

Permalink
Added StringSplits.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsagara committed Nov 16, 2023
1 parent 026a1e4 commit f712a06
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<LangVersion>12.0</LangVersion>

<!-- NuGet -->
<Version>2.0.4</Version>
<Version>2.0.5</Version>
<AssemblyVersion>2.0.0</AssemblyVersion>
<FileVersion>2.0.0</FileVersion>
<Authors>Jon Sagara</Authors>
Expand Down
16 changes: 16 additions & 0 deletions src/Sagara.Core/StringSplits.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Sagara.Core;

/// <summary>
/// Static array references to that we don't have to allocate an array every time we call string.Split.
/// </summary>
public static class StringSplits
{
public static readonly char[]
Colon = { ':' },
Comma = { ',' },
Email = { '@', '.' },
ForwardSlash = { '/' },
Newline = { '\n' },
NewlineCarriageReturn = { '\n', '\r' },
Semicolon = { ';' };
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#### [Sagara.Core](index.md 'index')
### [Sagara.Core.Json.SystemTextJson](index.md#Sagara.Core.Json.SystemTextJson 'Sagara.Core.Json.SystemTextJson')

## STJsonHelper Class
## SystemTextJsonHelper Class

Helper methods for serializing JSON with System.Text.Json.

```csharp
public static class STJsonHelper
public static class SystemTextJsonHelper
```

Inheritance [System.Object](https://docs.microsoft.com/en-us/dotnet/api/System.Object 'System.Object') &#129106; STJsonHelper
Inheritance [System.Object](https://docs.microsoft.com/en-us/dotnet/api/System.Object 'System.Object') &#129106; SystemTextJsonHelper
### Methods

<a name='Sagara.Core.Json.SystemTextJson.STJsonHelper.Deserialize_T_(string,bool)'></a>
<a name='Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.Deserialize_T_(string,bool)'></a>

## STJsonHelper.Deserialize<T>(string, bool) Method
## SystemTextJsonHelper.Deserialize<T>(string, bool) Method

Parse the JSON string into into an instance of the type specified by a generic type parameter. Default
is to use case-insensitive property names.
Expand All @@ -24,31 +24,31 @@ public static T? Deserialize<T>(string json, bool caseInsensitivePropertyNames=t
```
#### Type parameters

<a name='Sagara.Core.Json.SystemTextJson.STJsonHelper.Deserialize_T_(string,bool).T'></a>
<a name='Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.Deserialize_T_(string,bool).T'></a>

`T`
#### Parameters

<a name='Sagara.Core.Json.SystemTextJson.STJsonHelper.Deserialize_T_(string,bool).json'></a>
<a name='Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.Deserialize_T_(string,bool).json'></a>

`json` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')
The JSON string to parse.

<a name='Sagara.Core.Json.SystemTextJson.STJsonHelper.Deserialize_T_(string,bool).caseInsensitivePropertyNames'></a>
<a name='Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.Deserialize_T_(string,bool).caseInsensitivePropertyNames'></a>

`caseInsensitivePropertyNames` [System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')
True to use case-insensitive property names; false to use
case-sensitive property names. Default is true.

#### Returns
[T](Sagara.Core.Json.SystemTextJson.STJsonHelper.md#Sagara.Core.Json.SystemTextJson.STJsonHelper.Deserialize_T_(string,bool).T 'Sagara.Core.Json.SystemTextJson.STJsonHelper.Deserialize<T>(string, bool).T')
[T](Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.md#Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.Deserialize_T_(string,bool).T 'Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.Deserialize<T>(string, bool).T')
The deserialized object of type T.

<a name='Sagara.Core.Json.SystemTextJson.STJsonHelper.Serialize_TValue_(TValue,bool,bool)'></a>
<a name='Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.Serialize_TValue_(TValue,bool,bool)'></a>

## STJsonHelper.Serialize<TValue>(TValue, bool, bool) Method
## SystemTextJsonHelper.Serialize<TValue>(TValue, bool, bool) Method

Convert the value into a JSON string. Default is camelCase property names and minified output.

Expand All @@ -57,24 +57,24 @@ public static string Serialize<TValue>(TValue value, bool camelCase=true, bool p
```
#### Type parameters

<a name='Sagara.Core.Json.SystemTextJson.STJsonHelper.Serialize_TValue_(TValue,bool,bool).TValue'></a>
<a name='Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.Serialize_TValue_(TValue,bool,bool).TValue'></a>

`TValue`
#### Parameters

<a name='Sagara.Core.Json.SystemTextJson.STJsonHelper.Serialize_TValue_(TValue,bool,bool).value'></a>
<a name='Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.Serialize_TValue_(TValue,bool,bool).value'></a>

`value` [TValue](Sagara.Core.Json.SystemTextJson.STJsonHelper.md#Sagara.Core.Json.SystemTextJson.STJsonHelper.Serialize_TValue_(TValue,bool,bool).TValue 'Sagara.Core.Json.SystemTextJson.STJsonHelper.Serialize<TValue>(TValue, bool, bool).TValue')
`value` [TValue](Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.md#Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.Serialize_TValue_(TValue,bool,bool).TValue 'Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.Serialize<TValue>(TValue, bool, bool).TValue')

The value to convert to JSON.

<a name='Sagara.Core.Json.SystemTextJson.STJsonHelper.Serialize_TValue_(TValue,bool,bool).camelCase'></a>
<a name='Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.Serialize_TValue_(TValue,bool,bool).camelCase'></a>

`camelCase` [System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')
True to use camelCase property naming; false to use PascalCase. Default is true.

<a name='Sagara.Core.Json.SystemTextJson.STJsonHelper.Serialize_TValue_(TValue,bool,bool).prettyPrint'></a>
<a name='Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.Serialize_TValue_(TValue,bool,bool).prettyPrint'></a>

`prettyPrint` [System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')
Expand Down
12 changes: 12 additions & 0 deletions src/Sagara.Core/docs/Sagara.Core.StringSplits.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#### [Sagara.Core](index.md 'index')
### [Sagara.Core](index.md#Sagara.Core 'Sagara.Core')

## StringSplits Class

Static array references to that we don't have to allocate an array every time we call string.Split.

```csharp
public static class StringSplits
```

Inheritance [System.Object](https://docs.microsoft.com/en-us/dotnet/api/System.Object 'System.Object') &#129106; StringSplits
7 changes: 4 additions & 3 deletions src/Sagara.Core/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
and then copy this new value back to [CurrentGuid](Sagara.Core.SequentialGuid.md#Sagara.Core.SequentialGuid.CurrentGuid 'Sagara.Core.SequentialGuid.CurrentGuid').
- **[operator ++(SequentialGuid)](Sagara.Core.SequentialGuid.md#Sagara.Core.SequentialGuid.op_Increment(Sagara.Core.SequentialGuid) 'Sagara.Core.SequentialGuid.op_Increment(Sagara.Core.SequentialGuid)')** `Operator` Increment one or more bytes of [CurrentGuid](Sagara.Core.SequentialGuid.md#Sagara.Core.SequentialGuid.CurrentGuid 'Sagara.Core.SequentialGuid.CurrentGuid') to get the next sequential Guid,
and then copy this new value back to [CurrentGuid](Sagara.Core.SequentialGuid.md#Sagara.Core.SequentialGuid.CurrentGuid 'Sagara.Core.SequentialGuid.CurrentGuid').
- **[StringSplits](Sagara.Core.StringSplits.md 'Sagara.Core.StringSplits')** `Class` Static array references to that we don't have to allocate an array every time we call string.Split.

<a name='Sagara.Core.Enums'></a>

Expand Down Expand Up @@ -78,10 +79,10 @@
<a name='Sagara.Core.Json.SystemTextJson'></a>

## Sagara.Core.Json.SystemTextJson Namespace
- **[STJsonHelper](Sagara.Core.Json.SystemTextJson.STJsonHelper.md 'Sagara.Core.Json.SystemTextJson.STJsonHelper')** `Class` Helper methods for serializing JSON with System.Text.Json.
- **[Deserialize&lt;T&gt;(string, bool)](Sagara.Core.Json.SystemTextJson.STJsonHelper.md#Sagara.Core.Json.SystemTextJson.STJsonHelper.Deserialize_T_(string,bool) 'Sagara.Core.Json.SystemTextJson.STJsonHelper.Deserialize<T>(string, bool)')** `Method` Parse the JSON string into into an instance of the type specified by a generic type parameter. Default
- **[SystemTextJsonHelper](Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.md 'Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper')** `Class` Helper methods for serializing JSON with System.Text.Json.
- **[Deserialize&lt;T&gt;(string, bool)](Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.md#Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.Deserialize_T_(string,bool) 'Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.Deserialize<T>(string, bool)')** `Method` Parse the JSON string into into an instance of the type specified by a generic type parameter. Default
is to use case-insensitive property names.
- **[Serialize&lt;TValue&gt;(TValue, bool, bool)](Sagara.Core.Json.SystemTextJson.STJsonHelper.md#Sagara.Core.Json.SystemTextJson.STJsonHelper.Serialize_TValue_(TValue,bool,bool) 'Sagara.Core.Json.SystemTextJson.STJsonHelper.Serialize<TValue>(TValue, bool, bool)')** `Method` Convert the value into a JSON string. Default is camelCase property names and minified output.
- **[Serialize&lt;TValue&gt;(TValue, bool, bool)](Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.md#Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.Serialize_TValue_(TValue,bool,bool) 'Sagara.Core.Json.SystemTextJson.SystemTextJsonHelper.Serialize<TValue>(TValue, bool, bool)')** `Method` Convert the value into a JSON string. Default is camelCase property names and minified output.

<a name='Sagara.Core.Time'></a>

Expand Down

0 comments on commit f712a06

Please sign in to comment.