月曜日, 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);

RP2040 Zero で MicroPython を使う

  埋め込み用マイコンでも Python を動かせる MicroPython というものがあります。 リアルタイムでコマンドラインからマイコンを動かせる画期的なシステムなので、ちょっとした感動が味わえます。 使い方としては、まずファームウエアをアップロードしてドライブとして認識さ...