Re: StringBuilder Extension: IsQuotedBy
Hugh Brown <[email protected]> Thu, 14 Feb 2008 19:34:07 -0800
| Newsgroups | gmane.comp.windows.devel.dotnet.clr |
|---|---|
| Message-ID | <[email protected]> |
Re: ...and StringBuilder does not have the methods you use. You mean StartsWith() and EndsWith()? Notice that I changed from StringBuilder to String. Brady Kelly <[email protected]> wrote: No, I don't reverse the quote token (an oversight), and StringBuilder does not have the methods you use. > -----Original Message----- > Sent: 14 February 2008 05:07 PM > To: [email protected] > Subject: Re: [DOTNET-CLR] StringBuilder Extension: IsQuotedBy > > Is your code the same as this: > > public static bool IsQuotedBy(string sb, string quoteString) > { > return sb.StartsWith(quoteString) && > sb.EndsWith(Reverse(quoteString)); > } > > public static bool Reverse(string s) > { > StringBuilder sb = new StringBuilder(); > for (int i = s.Length - 1; i >= 0; i--) > sb.Append(s[i]); > return sb.ToString(); > } =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com