linq.tools.js Reference

http://neue.cc/
http://linqjs.codeplex.com/

DateTimeUtility Tester

Linq.Tools.DateUtility.Format(new Date(), )
FormatString is : yyyy | yy | y | MM | M | dd | d
HH | H | hh | h | mm | m | ss | s | DDDD | DDD | dddd | ddd

Linq.Tools.DateUtility.Parse(, )
FormatString is : yyyy | MM | dd | HH | mm | ss

String.Format

method name return type arguments example (click code)
Template String String template, Object replacement
Linq.Tools.Template("My name is {name}. I'm {age} years old.", {name:"John", age:20})
String template, Array replacement
Linq.Tools.Template("My name is {0}. I'm {1} years old.", ["John", 20])
String template, params String args
Linq.Tools.Template("My name is {0}. I'm {1} years old.", "John", 20)

StringBuilder

method name return type arguments example (click code)
Create Linq.Tools.StringBuilder ()
var sb=Linq.Tools.StringBuilder.Create();
sb.Append("foo").Append("bar");
document.write(sb.ToString());
Append Linq.Tools.StringBuilder String value
var sb=Linq.Tools.StringBuilder.Create();
sb.Append("foo").Append("bar");
document.write(sb.ToString());
AppendLine Linq.Tools.StringBuilder String value
var sb=Linq.Tools.StringBuilder.Create();
sb.AppendLine("foo").AppendLine("bar");
document.write(sb.ToString());
AppendFormat Linq.Tools.StringBuilder Template
var sb=Linq.Tools.StringBuilder.Create();
sb.AppendFormat("My name is {name}. I'm {age} years old.", {name:"John", age:20});
sb.AppendFormat("Is this {0} or {1} ?{2}", ["Tomato", "Apple", "<br>"]);
sb.AppendFormat("Is this {0} or {1} ?{2}", "Orange", "Grape", "<br>");
document.write(sb.ToString());
Reverse Linq.Tools.StringBuilder ()
var sb=Linq.Tools.StringBuilder.Create();
sb.AppendFormat("abc").AppendFormat("foo").Reverse();
document.write(sb.ToString());
ToString String ()
var sb=Linq.Tools.StringBuilder.Create();
sb.Append("foo").Append("bar");
var str = sb.ToString();
document.write(str);

Stopwatch

method name return type arguments example (click code)
Create Linq.Tools.Stopwatch ()
var sw = Linq.Tools.Stopwatch.Create();
sw.Start();
E.Range(1,10000).Select("$*$").Force();
document.write(sw.Elapsed() + "ms");
StartNew Linq.Tools.Stopwatch ()
var sw = Linq.Tools.Stopwatch.StartNew();
E.Range(1,10000).Select("$*$").Force();
document.write(sw.Elapsed() + "ms");
Bench Number int times, void action(T)
var result = Linq.Tools.Stopwatch.Bench(100,function(){
    E.Range(1,100).Where("$%2==0").Select("$*$").Force()});
document.write(result + 'ms')
Start void ()
var sw = Linq.Tools.Stopwatch.Create();
sw.Start();
E.Range(1,10000).Select("$*$").Force();
document.write(sw.Elapsed() + "ms");
Stop void ()
var sw = Linq.Tools.Stopwatch.StartNew();
sw.Stop();
document.write(sw.Elapsed() + "ms");
Reset void ()
var sw = Linq.Tools.Stopwatch.StartNew();
E.Range(1,10000).Select("$*$").Force();
sw.Reset();
document.write(sw.Elapsed() + "ms");
IsRunning void ()
var sw = Linq.Tools.Stopwatch.StartNew();
document.write(sw.IsRunning());
sw.Stop();
document.write(sw.IsRunning());
Elapsed Number ()
var sw = Linq.Tools.Stopwatch.Create();
sw.Start();
E.Range(1,10000).Select("$*$").Force();
sw.Stop();
document.write(sw.Elapsed() + "ms");

HashSet

method name return type arguments example (click code)
Create Linq.Tools.HashSet ()
var hs=Linq.Tools.HashSet.Create();
hs.Add("foo");
document.write(hs.Contains("foo"));
document.write(hs.Contains("bar"));
params T keys
var hs=Linq.Tools.HashSet.Create("foo","bar");
document.write(hs.Contains("foo"));
Array keys
var hs=Linq.Tools.HashSet.Create(["foo","bar"]);
document.write(hs.Contains("foo"));
Add void ()
var hs=Linq.Tools.HashSet.Create();
hs.Add("foo");
document.write(hs.Contains("foo"));
AsLinqable Linq.Object ()
var hs=Linq.Tools.HashSet.Create("foo","bar");
var keys = hs.AsLinqable();
keys.Select("'key='+$").WriteLine();
Clear void ()
var hs=Linq.Tools.HashSet.Create("foo","bar");
hs.Clear();
document.write(hs.Contains("foo"));
Contains void ()
var hs=Linq.Tools.HashSet.Create("foo","bar");
document.write(hs.Contains("foo"));
Count int ()
var hs=Linq.Tools.HashSet.Create("foo","bar");
document.write(hs.Count());
Remove void ()
var hs=Linq.Tools.HashSet.Create("foo","bar");
hs.Remove("foo");
document.write(hs.Count());

HttpUtility

method name return type arguments example (click code)
HtmlEncode String String input
var str = Linq.Tools.HttpUtility.HtmlEncode("<tag>foo&bar<tag>");
alert(str);
HtmlDecode String String input
var str = Linq.Tools.HttpUtility.HtmlDecode("&lt;tag&gt;foo&amp;bar");
alert(str);
ParseQueryString Object String query
var q = Linq.Tools.HttpUtility.ParseQueryString("http://a.b/c.cgi?foo=tomato&bar=orange");
E.From(q).Select("$.Key + '=' + $.Value").WriteLine();
ToQueryString String Object obj
var str = Linq.Tools.HttpUtility.ToQueryString({foo:"tomato",bar:"banana"});
document.write(str);

DateUtility

method name return type arguments example (click code)
DaysInMonth Number int year, int month
var str = Linq.Tools.DateUtility.DaysInMonth(2008,2);
document.write(str);
IsLeapYear Bool int year
var b1 = Linq.Tools.DateUtility.IsLeapYear(2009);
var b2 = Linq.Tools.DateUtility.IsLeapYear(2008);
document.write(b1 + ":" + b2);
Format String Date date, String format
var str = Linq.Tools.DateUtility.Format(new Date(),"yyyy/MM/dd HH:mm:ss");
document.write(str);
Parse Date String strDate, String format
var date = Linq.Tools.DateUtility.Parse("2009/10/05 13:24:11","yyyy/MM/dd HH:mm:ss");
document.write(date);