月曜日, 8月 21, 2006

String.split() Function in Java

String.split() fundtion is quite handy in that it can set delimiters
in regular expression format. In order to obtain a list of fragments
of a string, supply an argument as follows.

str.split(" ");

In using Unicode, the whitespace can be set as follows.

str.split("\\p{javaWhitespace}");

In this way, whitespaces such as Japanese whitespace can be specified.

Some other figures are added to Java's regular expression than standard ones. The date expression such as 2006-08-22 can be specified in the format as follows.

String regex="\\d{4}-\\d{2}-\\d{2}";
String contents[]=text.split(regex);

I2S プロトコル

I²S(Inter-IC Sound)は、マイコンやオーディオ機器間で音声データをやり取りするために設計された、シリアル通信プロトコルです。I²CやSPIと名前は似ていますが、I²Sは音声専用のプロトコルです。 I²Sは、以下の3つの主要な信号線を使って通信します。 BCLK (...