Skip to content

Commit

Permalink
Refactoring the SpecialAndInvalidCharacters to single line
Browse files Browse the repository at this point in the history
  • Loading branch information
jesusalvino committed Apr 19, 2022
1 parent 7c4e4ce commit 5df10f1
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions src/DynamoCore/Search/SearchDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,23 +325,8 @@ private static string[] SplitOnWhiteSpace(string s)

public static Char[] SpecialAndInvalidCharacters()
{
char[] invalidFileChars = System.IO.Path.GetInvalidFileNameChars();

List<string> filteredChars = new List<string>();
foreach (char someChar in invalidFileChars)
{ // Excluding white spaces and uncommon characters, only keeping the displayed in the Windows alert
if (!Char.IsWhiteSpace(someChar) && (int)someChar > 31)
{
filteredChars.Add(someChar.ToString());
}
}

char[] result = new char[filteredChars.Count];
for (int i = 0; i < filteredChars.Count; i++)
{
result[i] = char.Parse(filteredChars[i]);
}
return result;
// Excluding white spaces and uncommon characters, only keeping the displayed in the Windows alert
return System.IO.Path.GetInvalidFileNameChars().Where(x => !char.IsWhiteSpace(x) && (int)x > 31).ToArray();

This comment has been minimized.

Copy link
@QilongTang

QilongTang Apr 19, 2022

Contributor

👍🏻

}

public static bool ContainsSpecialCharacters(string element)
Expand Down

0 comments on commit 5df10f1

Please sign in to comment.