mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-01-11 19:44:55 +00:00
37 lines
829 B
C#
37 lines
829 B
C#
using System;
|
|
using System.Text;
|
|
|
|
namespace ICD.Common.Utils.Extensions
|
|
{
|
|
public static class StringBuilderExtensions
|
|
{
|
|
/// <summary>
|
|
/// Empties the StringBuilder.
|
|
/// </summary>
|
|
/// <param name="extends"></param>
|
|
public static void Clear(this StringBuilder extends)
|
|
{
|
|
if (extends == null)
|
|
throw new ArgumentNullException("extends");
|
|
|
|
extends.Remove(0, extends.Length);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns the current string value of the StringBuilder and clears the
|
|
/// StringBuilder for further use.
|
|
/// </summary>
|
|
/// <param name="extends"></param>
|
|
/// <returns></returns>
|
|
public static string Pop(this StringBuilder extends)
|
|
{
|
|
if (extends == null)
|
|
throw new ArgumentNullException("extends");
|
|
|
|
string output = extends.ToString();
|
|
extends.Clear();
|
|
return output;
|
|
}
|
|
}
|
|
}
|