2009-06-01から1ヶ月間の記事一覧

slimeでminibufferでの引数リストをすべて表示させる

emacs + slimeでminibufferに引数リストが表示されるのだが、デフォルトでは1行分しか表示されないため、引数が多い関数を使う場合にリファレンスを見ることになる。 hyperspec にのってるやつなら C-c C-d hでブラウザが立ち上がるのでそれほど苦でもないの…

文字から文字コードを調べる

ちょうど昨日の逆です。 例はやっぱり全角スペース。 $ echo -n ' ' | od -t x1 0000000 e3 80 80 0000003 まぁこんな感じ。 これはlocaleがja_JP.utf-8なのでutf-8ででてます。別の文字コードや元のロケールが違う場合は途中にiconvなど挟んで変換してやれ…

LinuxというかPosix環境で文字コードに該当する文字を調べる方法

いままではrdpつかってwindowsのバイナリエディタを使ってたんですがふと思いついたのでメモ。別に大したことではないのだけど・・・例えば 0x81 0x40のシーケンス(SJISでの全角スペース)とかを見たい場合 $ echo -e "\x81\x40" | lv -Is 別にページャはlvで…

functor版tolower

c++

#include <locale> #include <iostream> #include <string> #include <functional> #include <algorithm> int main() { std::locale loc("ja_JP.UTF-8"); const std::ctype<char>& cty = std::use_facet<std::ctype<char> >(loc); std::string str = "HELLO WORLD."; std::cout << str << std::endl; std::transform(str.be…</std::ctype<char></char></algorithm></functional></string></iostream></locale>

tolower

c++

#include <locale> #include <iostream> #include <string> int main() { std::locale loc("ja_JP.UTF-8"); const std::ctype<char>& cty = std::use_facet<std::ctype<char> >(loc); std::string str = "HELLO WORLD."; std::cout << str << std::endl; for (std::string::iterator itor = str.begin(); itor </std::ctype<char></char></string></iostream></locale>…