2010-05-17から1日間の記事一覧

参照の比較演算

aとbは別のインスタンス(メモリ空間)を持っているので、イコールじゃfalseになるからString.equals()を使おうという話。 まぁ有名な話ですよね。 String a = new String("hoge"); String b = new String("hoge"); println("aとbは" + (a==b)); // false St…

テキスト周りのまとめ

size(400, 300); background(255); fill(0); textFont(createFont("FixedSys", 32)); int halfW = width>>1, halfH = height>>1; int top = (int)textAscent(); int bottom = (int)textDescent(); String str = "へろーわーるど"+str(top+bottom); int x = h…