12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace EVCB_OCPP.WSServer.Helper;
- public static class StringBuilderExtention
- {
- private readonly static char[] m_CrCf;
- static StringBuilderExtention()
- {
- m_CrCf = "\r\n".ToArray();
- }
- /// <summary>
- /// Appends in the format with CrCf as suffix.
- /// </summary>
- /// <param name="builder">The builder.</param>
- /// <param name="format">The format.</param>
- /// <param name="arg">The arg.</param>
- public static void AppendFormatWithCrCf(this StringBuilder builder, string format, object arg)
- {
- builder.AppendFormat(format, arg);
- builder.Append(m_CrCf);
- }
- /// <summary>
- /// Appends in the format with CrCf as suffix.
- /// </summary>
- /// <param name="builder">The builder.</param>
- /// <param name="format">The format.</param>
- /// <param name="args">The args.</param>
- public static void AppendFormatWithCrCf(this StringBuilder builder, string format, params object[] args)
- {
- builder.AppendFormat(format, args);
- builder.Append(m_CrCf);
- }
- /// <summary>
- /// Appends with CrCf as suffix.
- /// </summary>
- /// <param name="builder">The builder.</param>
- /// <param name="content">The content.</param>
- public static void AppendWithCrCf(this StringBuilder builder, string content)
- {
- builder.Append(content);
- builder.Append(m_CrCf);
- }
- /// <summary>
- /// Appends with CrCf as suffix.
- /// </summary>
- /// <param name="builder">The builder.</param>
- public static void AppendWithCrCf(this StringBuilder builder)
- {
- builder.Append(m_CrCf);
- }
- }
|