Replaced regex with a while loop

This commit is contained in:
Szymon Seliga
2016-01-15 16:50:25 +01:00
parent 7bb8868146
commit 7ca31ab097

View File

@@ -358,7 +358,12 @@ namespace Orchard.ContentTypes.Services {
}
private static string VersionName(string name) {
var substring = Regex.Match(name, @"\d+$").Value;
var i = name.Length - 1;
while (i >= 0 && char.IsDigit(name, i)) {
i--;
}
var substring = i != name.Length - 1 ? name.Substring(i + 1) : string.Empty;
int version;
if (int.TryParse(substring, out version)) {