Skip to content

Commit

Permalink
play it safe, trim whitespaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
Arcitectus committed Dec 20, 2015
1 parent b996f1e commit 5d363aa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Sanderling/Sanderling/Parse/Extension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ static public INeocom Parse(this MemoryStruct.INeocom Neocom) =>
SetKeyCodeFromUIText?.CastToNullable()?.FirstOrDefault(UITextAndKeyCode =>
string.Equals(UITextAndKeyCode?.Key, KeyUIText, System.StringComparison.OrdinalIgnoreCase))?.Value;

static public IEnumerable<VirtualKeyCode> ListKeyCodeFromUIText(this string ListKeyUIText)
static public IEnumerable<VirtualKeyCode> ListKeyCodeFromUIText(this string ListKeyUITextAggregated)
{
if (null == ListKeyUIText)
if (null == ListKeyUITextAggregated)
return null;

var ListComponent = Regex.Split(ListKeyUIText, "-");
var ListKeyText = Regex.Split(ListKeyUITextAggregated.Trim(), "-")?.Select(KeyText => KeyText.Trim())?.ToArray();

var ListKey = ListComponent?.Where(KeyText => 0 < KeyText?.Length)?.Select(KeyCodeFromUIText)?.ToArray();
var ListKey = ListKeyText?.Where(KeyText => 0 < KeyText?.Length)?.Select(KeyCodeFromUIText)?.ToArray();

if (ListKey?.Any(Key => null == Key) ?? true)
return null;
Expand Down

0 comments on commit 5d363aa

Please sign in to comment.