#105 – Chaining String Functions Together
September 30, 2010 Leave a comment
Because many functions that operate on strings return a modified string, you can then pass that resulting string into another function that will operate on the new string. In this way, you can chain together several string operations on the same line of code.
char[] braces = new char[] {'{', '}'}; string s = "{This|That|Such}"; s = s.Replace("|", " and ").Trim(braces).Insert(0, "=> ").ToLower(); Console.WriteLine(s); // => this and that and such