using System; namespace Unity.VisualScripting { /// /// Selects a value from a set by switching over a string. /// [UnitCategory("Control")] [UnitTitle("Select On String")] [UnitShortTitle("Select")] [UnitSubtitle("On String")] [UnitOrder(7)] public class SelectOnString : SelectUnit { [Serialize] [Inspectable, UnitHeaderInspectable("Ignore Case")] [InspectorToggleLeft] public bool ignoreCase { get; set; } protected override bool Matches(string a, string b) { if (string.IsNullOrEmpty(a) && string.IsNullOrEmpty(b)) { return true; } return string.Equals(a, b, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal); } } }