Navigation Menu

Skip to content
This repository has been archived by the owner on Feb 12, 2018. It is now read-only.

Commit

Permalink
Chr completed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paris committed Oct 20, 2010
1 parent b239a2a commit bc886d8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion IronAHK/Site/docs/developing/status/index.html
Expand Up @@ -34,7 +34,7 @@
["BlockInput", false, false, false, false, ""],
["Break", false, false, false, false, ""],
["Ceil", true, true, true, true, ""],
["Chr", false, false, false, false, ""],
["Chr", true, true, true, true, ""],
["Click", false, false, false, false, ""],
["ClipWait", false, false, false, false, ""],
["Continue", false, false, false, false, ""],
Expand Down
10 changes: 0 additions & 10 deletions Rusty/Core/Math.cs
Expand Up @@ -56,16 +56,6 @@ public static decimal Ceil(decimal n)
return Math.Ceiling(n);
}

/// <summary>
/// Returns the single character corresponding to the Unicode value indicated by a number.
/// </summary>
/// <param name="Number">A positive integer.</param>
/// <returns></returns>
public static string Chr(decimal Number)
{
return ((char)Number).ToString();
}

/// <summary>
/// Returns the cosent of a number in radians.
/// </summary>
Expand Down
10 changes: 10 additions & 0 deletions Rusty/Core/String.cs
Expand Up @@ -45,6 +45,16 @@ public static byte[] Base64Decode(string s)
return Convert.FromBase64String(s);
}

/// <summary>
/// Returns the single character corresponding to a Unicode value.
/// </summary>
/// <param name="n">A Unicode value.</param>
/// <returns>A Unicode character whose value is <paramref name="n"/>.</returns>
public static string Chr(int n)
{
return ((char)n).ToString();
}

/// <summary>
/// Transforms a YYYYMMDDHH24MISS timestamp into the specified date/time format.
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions Tests/Rusty/String.cs
Expand Up @@ -21,6 +21,13 @@ public void Asc()
Assert.AreEqual(0, Core.Asc(str, str.Length + 1));
}

[Test, Category("String")]
public void Chr()
{
foreach (var n in new[] { 0, 1, '.', '!', 'a', 'A', '≤', char.MaxValue - 1, -1 })
Assert.AreEqual(((char)n).ToString(), Core.Chr(n));
}

[Test, Category("String")]
public void SubStr()
{
Expand Down

0 comments on commit bc886d8

Please sign in to comment.