Skip to content

Commit

Permalink
allowing international letters like æøå (#12)
Browse files Browse the repository at this point in the history
Authored-by: Simen Samuelsen  https://github.com/samuelsen
  • Loading branch information
samuelsen authored Jan 8, 2022
1 parent 524e55e commit 8175808
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ public static string NormalizeVariableName(string name)
if (string.IsNullOrWhiteSpace(retVal))
throw new ArgumentException($"Variable name is null or empty",nameof(name));

if (retVal.Any(c => !(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == '_')))
if (retVal.Any(c => !(char.IsLetter(c) || char.IsDigit(c) || c == '_')))
throw new ArgumentException($"Variable name '{name}' contains invalid character", nameof(name));

if (!(retVal[0] >= 'a' && retVal[0] <= 'z' || retVal[0] >= 'A' && retVal[0] <= 'Z'))
if (!char.IsLetter(retVal[0]))
throw new ArgumentException($"Variable name '{nameof(name)}' must start with letter", nameof(name));

return retVal;
Expand Down

0 comments on commit 8175808

Please sign in to comment.