// NAnt - A .NET build tool
// Copyright (C) 2001-2003 Gerry Shaw
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Gert Driesen (gert.driesen@ardatis.com)
using System;
using System.Globalization;
using NAnt.Core;
using NAnt.Core.Types;
using NAnt.Core.Attributes;
namespace NAnt.Core.Functions {
[FunctionSet("int", "Conversion")]
public class Int32ConversionFunctions : FunctionSetBase {
#region Public Instance Constructors
public Int32ConversionFunctions(Project project, PropertyDictionary properties) : base(project, properties) {
}
#endregion Public Instance Constructors
#region Public Static Methods
///
/// Converts the specified string representation of a number to its
/// 32-bit signed integer equivalent.
///
/// A string containing a number to convert.
///
/// A 32-bit signed integer equivalent to the number contained in
/// .
///
/// is not of the correct format.
/// represents a number less than or greater than .
///
/// The for the invariant culture is
/// used to supply formatting information about .
///
[Function("parse")]
public static int Parse(string s) {
return int.Parse(s, CultureInfo.InvariantCulture);
}
///
/// Converts the specified to its equivalent string
/// representation.
///
/// A to convert.
///
/// The string representation of , consisting
/// of a negative sign if the value is negative, and a sequence of
/// digits ranging from 0 to 9 with no leading zeroes.
///
///
/// is formatted with the
/// for the invariant culture.
///
[Function("to-string")]
public static string ToString(int value) {
return value.ToString(CultureInfo.InvariantCulture);
}
#endregion Public Static Methods
}
}