Skip to content

Commit

Permalink
}} escape for String.Format
Browse files Browse the repository at this point in the history
svn path=/trunk/mcs/; revision=2322
  • Loading branch information
Dan Lewis committed Feb 11, 2002
1 parent 70b7cd6 commit 2fb02f0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mcs/class/corlib/System/String.cs
Original file line number Diff line number Diff line change
Expand Up @@ -752,11 +752,11 @@ public static string Format (IFormatProvider provider, string format, params obj
int start = ptr;
while (ptr < format.Length) {
char c = format[ptr ++];

if (c == '{') {
result.Append (format, start, ptr - start - 1);

// check for escaped bracket
// check for escaped open bracket

if (format[ptr] == '{') {
start = ptr ++;
Expand Down Expand Up @@ -804,6 +804,10 @@ public static string Format (IFormatProvider provider, string format, params obj

start = ptr;
}
else if (c == '}' && format[ptr] == '}') {
result.Append (format, start, ptr - start - 1);
start = ptr ++;
}
}

if (start < format.Length)
Expand Down

0 comments on commit 2fb02f0

Please sign in to comment.