mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
trim leading and trailing whitespace from rules
This commit is contained in:
parent
71dc4968d3
commit
97a4816842
1 changed files with 7 additions and 0 deletions
|
|
@ -5,12 +5,19 @@ public static class RawRuleLinterExtensions
|
|||
//TODO: resolve issues and/or track dropped rules
|
||||
public static string LintStringForMySql(this string rule)
|
||||
{
|
||||
rule = rule.TrimLeadingAndTrailingWhitespace();
|
||||
rule = rule.TrimSingleBackslashFromEnd();
|
||||
rule = rule.DropIfContainsBackslashSingleQuote();
|
||||
rule = rule.DropIfTooLong();
|
||||
return rule;
|
||||
}
|
||||
|
||||
private static string TrimLeadingAndTrailingWhitespace(this string rule)
|
||||
{
|
||||
char[] charsToTrim = {' ', '\t'};
|
||||
return rule.Trim(charsToTrim);
|
||||
}
|
||||
|
||||
private static string TrimSingleBackslashFromEnd(this string rule)
|
||||
{
|
||||
if (rule != null)
|
||||
|
|
|
|||
Loading…
Reference in a new issue