using System;
using Microsoft.AspNetCore.Mvc;
namespace Jellyfin.Api
{
///
/// Base api controller for the API setting a default route.
///
[ApiController]
[Route("[controller]")]
public class BaseJellyfinApiController : ControllerBase
{
///
/// Splits a string at a seperating character into an array of substrings.
///
/// The string to split.
/// The char that seperates the substrings.
/// Option to remove empty substrings from the array.
/// An array of the substrings.
internal static string[] Split(string value, char separator, bool removeEmpty)
{
if (string.IsNullOrWhiteSpace(value))
{
return Array.Empty();
}
return removeEmpty
? value.Split(new[] { separator }, StringSplitOptions.RemoveEmptyEntries)
: value.Split(separator);
}
}
}