2008-08-26から1日間の記事一覧

ActiveSupport、String#last

まんま >> require "rubygems" => true >> require "active_support" => true >> "hello".last => "o" >> "hello".last(2) => "lo" >> "hello".last(10) => "hello"

JDK5.0 新機能:EnumSet.noneOf

「4.6. EnumSet」 import java.util.*; enum C2008082600_Color { RED, BLUE, YELLOW, BLACK, WHITE } public class C2008082600 { public static void main(String[] args) { EnumSet<C2008082600_Color> s = EnumSet.noneOf(C2008082600_Color.class); System.out.println(s);</c2008082600_color>…

ディレクティブ score、変数 $score, $score_return

#!/usr/bin/env perl use strict; use Parse::RecDescent; my $grammar = q{ inputs : 'a' { print "*a1 $score $score_return*\n"; } <score: 1> | 'a' { print "*a2 $score $score_return*\n"; } <score: 2> | 'a' { print "*a3 $score $score_return*\n"; } <score: 3> }; my $parse = n</score:></score:></score:>…

io.write

元 write ? #!/usr/bin/env lua io.write("foo") io.write("bar") io.write(1, "\n") --io.write(nil) --print(nil) で、 foobar1