Coree.NETStandard
  • API
Show / Hide Table of Contents
  • Coree.NETStandard.Abstractions
    • DependencySingleton<T>
    • FluentBase
    • IDependencySingleton
    • IFluentBase
  • Coree.NETStandard.Classes
    • ThreadSafeCollection<T>
    • ThreadSafeValue<T>
  • Coree.NETStandard.CoreeHttpClient
    • CoreeHttpClient
    • CoreeHttpClient2
    • HttpHeadersExtensions
    • HttpRequestHeadersExtensions
    • HttpResponseResult
    • HttpResponseResult.OperationStatus
    • HttpResponseResult2
    • HttpResponseResult2.OperationStatus
    • ICoreeHttpClient
    • Product
    • ProductExtensions
    • RequestContentBuilder
    • RequestParamBuilder
    • ServiceCollectionExtensions
    • UriExtensions
  • Coree.NETStandard.Extensions
    • BoolExtensions
    • CancellationTokenExtensions
    • EnumerableStringExtension
    • EnumerableTExtension
    • HostApplicationBuilderExtensions
    • ServiceProviderExtensions
    • StringBuilderExtension
    • StringsExtensions
  • Coree.NETStandard.HostedServicesCollection
    • HostedServicesCollectionConfig<T>
    • IHostedServicesCollectionConfig<T>
    • ServiceCollectionExtensions
    • ServiceProviderExtensions
  • Coree.NETStandard.Serilog
    • ConditionalLevelSink
    • LoggerSinkConfigurationExtensions
    • OutputTemplates
    • ServiceCollectionExtensions
    • SourceContextShortEnricher
  • Coree.NETStandard.Services
    • IRuntimeInsights
    • RuntimeInsightsService
  • Coree.NETStandard.Services.File
    • FileService
    • IFileService
  • Coree.NETStandard.Services.Process
    • IProcessService
    • ProcessRunExitCodeState
    • ProcessRunResult
    • ProcessService
  • Coree.NETStandard.Services.RuntimeInsights
    • IRuntimeInsightsService
    • RuntimeInsightsService
  • Coree.NETStandard.SpectreConsole
    • CommandAppExtensions
    • HostBuilderExtensions
    • ServiceCollectionExtensions
    • SpectreConsoleHostedService
    • SpectreConsoleHostedService.ExitCode
    • SpectreConsoleTypeRegistrar
    • SpectreConsoleTypeResolver
  • Coree.NETStandard.Utilities
    • MainContext

Class StringExtensions

Provides extension methods for string operations, enhancing the built-in string manipulation capabilities.

Inheritance
object
StringExtensions
Namespace: Coree.NETStandard.Extensions.Strings
Assembly: Coree.NETStandard.dll
Syntax
public static class StringExtensions

Methods

| Edit this page View Source

IsValidJson(string)

Validates whether the specified string is valid JSON.

Declaration
public static bool IsValidJson(this string jsonString)
Parameters
Type Name Description
string jsonString

The JSON string to validate.

Returns
Type Description
bool

true if the string is valid JSON; otherwise, false.

| Edit this page View Source

IsValidXml(string)

Validates whether the specified string is well-formed XML.

Declaration
public static bool IsValidXml(this string xmlString)
Parameters
Type Name Description
string xmlString

The XML string to validate.

Returns
Type Description
bool

true if the string is a well-formed XML; otherwise, false.

| Edit this page View Source

SplitWith(string?, char[], StringSplitOptions)

Splits the input string by an array of characters, treating them as a single connected delimiter, with options to control the split operation.

Declaration
public static string[] SplitWith(this string? input, char[] delimiter, StringSplitOptions options = StringSplitOptions.None)
Parameters
Type Name Description
string input

The string to be split.

char[] delimiter

The array of characters to form the delimiter.

StringSplitOptions options

Specifies whether to omit empty or whitespace-only substrings from the resulting array.

Returns
Type Description
string[]

An array of substrings that are delimited by the specified sequence of characters.

| Edit this page View Source

SplitWith(string?, string, StringSplitOptions)

Splits the input string by a specified string delimiter, with options to control the split operation.

Declaration
public static string[] SplitWith(this string? input, string delimiter, StringSplitOptions options = StringSplitOptions.None)
Parameters
Type Name Description
string input

The string to be split.

string delimiter

The string delimiter to split by.

StringSplitOptions options

Specifies whether to omit empty or whitespace-only substrings from the resulting array.

Returns
Type Description
string[]

An array of substrings that are delimited by the specified string.

| Edit this page View Source

SplitWith(string?, string[], StringSplitOptions)

Splits the input string by multiple string delimiters, with options to control the split operation.

Declaration
public static string[] SplitWith(this string? input, string[] delimiters, StringSplitOptions options = StringSplitOptions.None)
Parameters
Type Name Description
string input

The string to be split.

string[] delimiters

The array of string delimiters to split by.

StringSplitOptions options

Specifies whether to omit empty or whitespace-only substrings from the resulting array.

Returns
Type Description
string[]

An array of substrings that are delimited by any of the specified strings.

  • Edit this page
  • View Source
In this article
Back to top