StringExtensions
String extension methods
public static class StringExtensions
Namespace
Methods
IsComplexJson
Tries to figure out if the input string is a serialized JSON object/array
public static bool IsComplexJson(this string input)
Parameters
Parameter | Description |
---|---|
input |
The input string |
Returns
A true if string is serialized JSON, otherwise false
IsJson
Tries to figure out if the input string is a serialized JSON value
public static bool IsJson(this string input)
Parameters
Parameter | Description |
---|---|
input |
The input string |
Returns
A true if string is serialized JSON, otherwise false
ReplaceEnd
Replaces an original string from the end of an input string with the given replacement
public static string ReplaceEnd(this string input, string original, string replacement)
Parameters
Parameter | Description |
---|---|
input |
The input string |
original |
The original string to look for |
replacement |
The string to replace the original string with |
Returns
The updated string
TryParse<T>
Tries to parse a string into a strongly typed value
public static T? TryParse<T>(this string input)
where T : struct
Parameters
Parameter | Description |
---|---|
T |
The output type |
input |
The input string |
Returns
A nullable output type