public string GetStoryText() { var firstChar = AsA.ToLowerInvariant() .Replace("as an", String.Empty) .Replace("as a", String.Empty) .Trim() .FirstOrDefault(); var asAPrefix = "As a"; if ("aeiouAEIOU".IndexOf(firstChar) >= 0) { asAPrefix = "As an"; } if (!AsA.ToLowerInvariant().StartsWith("as a")) { AsA = $"{asAPrefix} {AsA}"; } if (!IWant.ToLowerInvariant().StartsWith("i want")) { IWant = $"I want {IWant}"; } if (!SoThat.ToLowerInvariant().StartsWith("so that")) { SoThat = $"So that {SoThat}"; } return($"{AsA}" + $"{Environment.NewLine}{IWant}" + $"{Environment.NewLine}{SoThat}{Environment.NewLine}"); }
private void PopulateAsA() { if (!string.IsNullOrEmpty(AsAn)) { AsA = AsAn; } if (AsA.StartsWith("as a", StringComparison.InvariantCultureIgnoreCase)) { return; } if (!string.IsNullOrEmpty(AsAn)) { AsA = $"As an {AsAn}"; } else if (AsA.StartsWith("a", StringComparison.InvariantCultureIgnoreCase)) { AsA = $"As an {AsA}"; } else { AsA = $"As a {AsA}"; } }
public string GetStoryText() { if (!AsA.ToLower().StartsWith("as a")) { AsA = $"As a {AsA}"; } if (!IWant.ToLower().StartsWith("i want")) { IWant = $"I want {IWant}"; } if (!SoThat.ToLower().StartsWith("so that")) { SoThat = $"So that {SoThat}"; } return($"{AsA}" + $"{Environment.NewLine}{IWant}" + $"{Environment.NewLine}{SoThat}{Environment.NewLine}"); }