Formats a string to an invariant culture

   
 
//---------------------------------------------------------------------
//  This file is part of the Background Motion solution.
// 
//  Copyright (C) Mindscape (TM).  All rights reserved.
//  http://www.mindscape.co.nz
// 
//  THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//  PARTICULAR PURPOSE.
//---------------------------------------------------------------------

using System.Globalization;

namespace Mindscape.BackgroundMotion.Core.Utilities
{
  /// <summary>
  /// A helper class which provides utilities for working with strings
  /// </summary>
  public static class StringUtils
  {
    /// <summary>
    /// Formats a string to an invariant culture
    /// </summary>
    /// <param name="formatString">The format string.</param>
    /// <param name="objects">The objects.</param>
    /// <returns></returns>
    public static string FormatInvariant(string formatString, params object[] objects)
    {
      return string.Format(CultureInfo.InvariantCulture, formatString, objects);
    }

    /// <summary>
    /// Formats a string to the current culture.
    /// </summary>
    /// <param name="formatString">The format string.</param>
    /// <param name="objects">The objects.</param>
    /// <returns></returns>
    public static string FormatCurrentCulture(string formatString, params object[] objects)
    {
      return string.Format(CultureInfo.CurrentCulture, formatString, objects);
    }
  }
}

   
     


This entry was posted in Data Types. Bookmark the permalink.