public static string Booify(string code)
{
if (code.Length == 0)
{
return "output string.Empty\r\n";
}
StringWriter buffer = new StringWriter();
int index = 0;
int lastIndex = 0;
string start, end;
DictionaryEntry seperators = GetSeperators(code);
start = seperators.Key.ToString();
end = seperators.Value.ToString();
while (index != -1)
{
index = code.IndexOf(start, lastIndex);
if (index == -1)
break;
Output(buffer, code.Substring(lastIndex, index - lastIndex));
int startReading = index + start.Length;
lastIndex = code.IndexOf(end, startReading);
if (lastIndex == -1)
throw new RailsException("expected " + end);
buffer.WriteLine(code.Substring(startReading, lastIndex - startReading));
lastIndex += end.Length;
}
Output(buffer, code.Substring(lastIndex));
return buffer.ToString();
}