Exemplo n.º 1
0
        public static string StripADName(string name)
        {
            // AD name may come in with ',' at the end ('ou=example,')
            name = name.Trim(',');

            var sb = new StringBuilder(name.Length);

            foreach (var t in name.Where(t => !RepositoryPath.IsInvalidNameChar(t)))
            {
                sb.Append(t);
            }
            return(sb.ToString().TrimEnd('.').Trim());
        }
Exemplo n.º 2
0
        public static string StripADName(string name)
        {
            // cserepesm: ad name may come in with ',' at the end ('ou=example,')
            name = name.Trim(',');

            var sb = new StringBuilder(name.Length);

            for (int i = 0; i < name.Length; i++)
            {
                //if (!RepositoryPath.InvalidNameChars.Contains(name[i]))
                if (!RepositoryPath.IsInvalidNameChar(name[i]))
                {
                    sb.Append(name[i]);
                }
            }
            return(sb.ToString().TrimEnd('.').Trim());  // leading and trailing whitespaces and trailing '.' is trimmed
        }