示例#1
0
        /// <summary>
        /// Gets the Pascal case name for ALL UPPER or all lower names.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        private static string GetPascalNameForSingleCaseName(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (name.Length == 0)
            {
                throw new ArgumentOutOfRangeException("'name' is zero-length.");
            }

            // return...
            name = name.Substring(0, 1).ToUpper() + name.Substring(1).ToLower();

            // look for an id match...
            Match match = IdRegex.Match(name);

            if (match.Success)
            {
                // mangle the ID...
                name = match.Groups["pre"].Value + "Id";
            }

            // return...
            return(name);
        }
        private static Vertex ReadTgfVertex(string line)
        {
            // read long id and label is the rest
            var idMatch = IdRegex.Match(line);

            if (!idMatch.Success)
            {
                return(null);
            }
            var idString = idMatch?.Value;
            var id       = long.Parse(idString);
            var label    = line.Substring(idString.Length).TrimStart(' ');
            var vertex   = new Vertex(id, label);

            return(vertex);
        }
 public bool AppliesTo(string identity)
 => IdRegex.IsMatch(identity);