diff options
| author | crobibero <cody@robibe.ro> | 2020-06-13 15:23:42 -0600 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-06-13 15:23:42 -0600 |
| commit | ce37c4074937e15e6cdd23f0f6e5016502ac2cee (patch) | |
| tree | 7263216cabb1e789fa9a2faa69c17187e7424e61 /Jellyfin.Api/Helpers/RequestHelpers.cs | |
| parent | 16e26be87f3c17422b7467882c5170fe11031825 (diff) | |
| parent | 0011e8df47380936742302ef40639a4626a780ed (diff) | |
Merge remote-tracking branch 'upstream/api-migration' into api-item-lookup
Diffstat (limited to 'Jellyfin.Api/Helpers/RequestHelpers.cs')
| -rw-r--r-- | Jellyfin.Api/Helpers/RequestHelpers.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Jellyfin.Api/Helpers/RequestHelpers.cs b/Jellyfin.Api/Helpers/RequestHelpers.cs new file mode 100644 index 000000000..9f4d34f9c --- /dev/null +++ b/Jellyfin.Api/Helpers/RequestHelpers.cs @@ -0,0 +1,29 @@ +using System; + +namespace Jellyfin.Api.Helpers +{ + /// <summary> + /// Request Extensions. + /// </summary> + public static class RequestHelpers + { + /// <summary> + /// Splits a string at a separating character into an array of substrings. + /// </summary> + /// <param name="value">The string to split.</param> + /// <param name="separator">The char that separates the substrings.</param> + /// <param name="removeEmpty">Option to remove empty substrings from the array.</param> + /// <returns>An array of the substrings.</returns> + internal static string[] Split(string value, char separator, bool removeEmpty) + { + if (string.IsNullOrWhiteSpace(value)) + { + return Array.Empty<string>(); + } + + return removeEmpty + ? value.Split(new[] { separator }, StringSplitOptions.RemoveEmptyEntries) + : value.Split(separator); + } + } +} |
