protected VitalRecord(IVoca personName) { if (personName == null) { return; } PersonFullName = NfString.DistillSpaces( string.Join(" ", personName.GetName(KindsOfNames.First), personName.GetName(KindsOfNames.Surname))); if (string.IsNullOrWhiteSpace(PersonFullName)) { PersonFullName = personName.GetName(KindsOfNames.Legal); } }
public AmericanDeathCert(MannerOfDeath mannerOfDeath, IVoca personName) : this(mannerOfDeath, (string)null) { if (personName == null) { return; } PersonFullName = NfString.DistillSpaces( string.Join(" ", personName.GetName(KindsOfNames.First), personName.GetName(KindsOfNames.Middle), personName.GetName(KindsOfNames.Surname))); if (string.IsNullOrWhiteSpace(PersonFullName)) { PersonFullName = personName.GetName(KindsOfNames.Legal); } }
public AmericanBirthCert(IVoca personName) : base((IVoca)null) { if (personName == null) { return; } PersonFullName = NfString.DistillSpaces( string.Join(" ", personName.GetName(KindsOfNames.First), personName.GetName(KindsOfNames.Middle), personName.GetName(KindsOfNames.Surname))); if (string.IsNullOrWhiteSpace(PersonFullName)) { PersonFullName = personName.GetName(KindsOfNames.Legal); } }
public static TagsetBase[] Parse(string taggedString) { var tagset = new List <TagsetBase>(); if (string.IsNullOrWhiteSpace(taggedString)) { return(tagset.ToArray()); } if (!taggedString.Contains(TagDelimiter.ToString())) { return(tagset.ToArray()); } taggedString = NfString.DistillCrLf(taggedString); var valueArray = taggedString.Split(' '); foreach (var wordTagPair in valueArray) { if (!wordTagPair.Contains(TagDelimiter.ToString(CultureInfo.InvariantCulture))) { tagset.Add(new NullTagset { Value = wordTagPair }); continue; } var tagPart = wordTagPair.Split(TagDelimiter)[1]; var tag = GetTagset(tagPart); if (tag.GetType() == typeof(NullTagset)) { tag.Value = wordTagPair; tagset.Add(tag); continue; } tag.Value = wordTagPair.Split(TagDelimiter)[0]; tagset.Add(tag); } return(tagset.ToArray()); }
public static Email RandomChildishEmail(bool usCommonOnly = true) { var shortWords = Etx.EnglishWords.Where(x => x.Item1.Length <= 3).Select(x => x.Item1).ToArray(); var shortWordList = new List <string>(); var otherWords = ChildishUserNames; var withUcase = NfString.CapWords(Etx.RandomPickOne(shortWords), ' '); shortWordList.Add(withUcase); shortWordList.Add(Etx.RandomPickOne(otherWords)); if (Etx.RandomCoinToss()) { shortWordList.Add(NfString.CapWords(Etx.RandomPickOne(shortWords), ' ')); } shortWordList = Etx.RandomShuffle(shortWordList.ToArray()).ToList(); if (Etx.RandomCoinToss()) { shortWordList.Add((Etx.RandomCoinToss() ? "_" : "") + Etx.RandomInteger(100, 9999)); } return(RandomEmail(string.Join("", shortWordList), usCommonOnly)); }
public static string MrecordName(string labelName) { var safeLabelName = NfString.SafeDotNetIdentifier(labelName); return(string.Format("{0}", safeLabelName)); }
internal static bool TryParseXml(XmlElement node, out AmericanHighSchool hs) { try { hs = new AmericanHighSchool(); if (node == null) { return(false); } if (node.LocalName != "high-school") { return(false); } var attr = node.Attributes["name"]; hs.Name = attr == null ? String.Empty : attr.Value; attr = node.Attributes["urban-centric"]; if (attr != null) { switch (attr.Value) { case "City-Large": hs.UrbanCentric = UrbanCentric.City | UrbanCentric.Large; break; case "City-Midsize": hs.UrbanCentric = UrbanCentric.City | UrbanCentric.Large; break; case "City-Small": hs.UrbanCentric = UrbanCentric.City | UrbanCentric.Small; break; case "Rural-Distant": hs.UrbanCentric = UrbanCentric.Rural | UrbanCentric.Distant; break; case "Rural-Fringe": hs.UrbanCentric = UrbanCentric.Rural | UrbanCentric.Fringe; break; case "Rural-Remote": hs.UrbanCentric = UrbanCentric.Rural | UrbanCentric.Remote; break; case "Suburb-Large": hs.UrbanCentric = UrbanCentric.Suburb | UrbanCentric.Large; break; case "Suburb-Midsize": hs.UrbanCentric = UrbanCentric.Suburb | UrbanCentric.Midsize; break; case "Suburb-Small": hs.UrbanCentric = UrbanCentric.Suburb | UrbanCentric.Small; break; case "Town-Distant": hs.UrbanCentric = UrbanCentric.Town | UrbanCentric.Distant; break; case "Town-Fringe": hs.UrbanCentric = UrbanCentric.Town | UrbanCentric.Fringe; break; case "Town-Remote": hs.UrbanCentric = UrbanCentric.Town | UrbanCentric.Remote; break; } } attr = node.Attributes["teachers"]; if (attr != null) { if (Double.TryParse(attr.Value, out var dblOut)) { hs.TotalTeachers = dblOut; } } attr = node.Attributes["total-students"]; if (attr != null) { if (Int32.TryParse(attr.Value, out var intOut)) { hs.TotalStudents = intOut; } } if (node.ParentNode == null || node.ParentNode.LocalName != "zip-stat" || node.ParentNode.Attributes?["value"] == null) { return(true); } var zipStatNode = node.ParentNode; if (zipStatNode.Attributes != null) { attr = zipStatNode.Attributes["value"]; } hs.PostalCode = attr?.Value; hs.Name = NfString.CapWords(hs.Name.Replace("JR\\SR", "Jr\\Sr"), ' '); return(true); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine($"{ex.Message}\n{ex.StackTrace}"); hs = null; return(false); } }
public override string ToString() { return(String.Join(" ", NfString.DistillToWholeWords(GetType().Name))); }
protected UsState(string stateAbbrv) { _stateAbbrev = stateAbbrv; _stateName = NfString.TransformCaseToSeparator(GetType().Name, ' '); }