mirror of https://github.com/abpframework/abp.git
Browse Source
Reference: https://stackoverflow.com/questions/773557/which-characters-are-allowed-in-a-vs-project-name
Reference: dcf5adbd4b/src/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/ValueForms/DefaultSafeNamespaceValueFormModel.cs (L35)
pull/2190/head
2 changed files with 23 additions and 0 deletions
@ -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 = Regex.Replace(value, @"(^\s+|\s+$)", ""); |
|||
value = Regex.Replace(value, @"(((?<=\.)|^)((?=\d)|\.)|[^\w\.])|(\.$)", "_"); |
|||
|
|||
return value; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue