mirror of https://github.com/abpframework/abp
Merge pull request #2190 from mehmetuken/cli-normalize-namespace
Resolved #1508 Adding cli namespace normalizer.pull/2205/head
commit
d7d3f6d4f1
@ -0,0 +1,21 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Volo.Abp.Cli.Utils
|
||||
{
|
||||
public static class NamespaceHelper
|
||||
{
|
||||
public static string NormalizeNamespace([CanBeNull] string value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
value = value.Trim();
|
||||
value = Regex.Replace(value, @"(((?<=\.)|^)((?=\d)|\.)|[^\w\.])|(\.$)", "_");
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue