Improve matching
add title case conversion
MODIFY
XRayBuilder.Core/src/Libraries/Primitives/Extensions/StringExtensions.cs
XRayBuilder.Core/src/Libraries/Primitives/Extensions/StringExtensions.cs
@@ -74,5 +74,17 @@ public static string TrimNonPrintableAscii(this string value)
var pattern = new Regex("[^ -~]+");
return pattern.Replace(value, "");
}
+
+ /// <summary>
+ /// Returns the specified string converted to Title Case
+ /// </summary>
+ public static string ToTitleCase(this string value)
+ {
+ if (string.IsNullOrEmpty(value) || value.Any(t => char.IsLetter(t) && !char.IsUpper(t)))
+ return value;
+
+ var textInfo = new CultureInfo("en-US",false).TextInfo;
+ return textInfo.ToTitleCase(value.ToLower());
+ }
}
}
\ No newline at end of file

- Improve matching
- add title case conversion

(cherry picked from commit cea8e54e48bfc2d7585ff024f295690cb6b344bb)