Virtu/Library/Xna/StringBuilderExtensions.cs
Sean Fausett 18ac684607 1) Cosmetic changes. 2) Removed volume from disk settings to simplify *.dsk support - if volume matters use another disk format.
--HG--
extra : convert_revision : svn%3Affd33b8c-2492-42e0-bdc5-587b920b7d6d/trunk%4020423
2009-06-01 10:34:24 +00:00

28 lines
756 B
C#

using System.Text;
namespace Jellyfish.Library
{
public static class StringBuilderExtensions
{
public static StringBuilder AppendWithoutGarbage(this StringBuilder builder, int number)
{
if (number < 0)
{
builder.Append('-');
}
int index = builder.Length;
do
{
builder.Insert(index, Digits, (number % 10) + 9, 1);
number /= 10;
}
while (number != 0);
return builder;
}
private static readonly char[] Digits = new char[] { '9', '8', '7', '6', '5', '4', '3', '2', '1', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
}
}