NAME

Jtext - length, substr, index and rindex available for Japanese Characters.


SYNOPSIS

  $line = jcode("これはeucテキストです。eucです。sjisではありません。")->euc;
  $length = length_euc($line);  # 31
  $text   = substr_euc($line,13,6);     # eucです。
  $text   = substr_euc($line,6,4,"文字");       # これはeuc文字です。...
  $text   = substr_euc($line,-1,5,"ない")."\n"; # ...sjisではない。
  $index  = index_euc($line,jcode("テキスト")->euc);    # 6
  $index  = index_euc($line,jcode("テキスト")->euc,9);  # -1
  $rindex = rindex_euc($line,jcode("euc")->euc);                # 13
  $rindex = rindex_euc($line,jcode("euc")->euc,30);     # -1


DESCRIPTION

Jtext is a module that makes length(), substr(), index() and rindex() available for Japanese Characters.


METHOD

length_euc / length_sjis

  length_euc  EXPR
  length_sjis EXPR
  $length = length_euc($line);  # 31

length() for Japanese Characters.

substr_euc / substr_sjis

  substr_euc  EXPR, OFFSET, LENGTH, REPLACEMENT
  substr_euc  EXPR, OFFSET, LENGTH
  substr_euc  EXPR, OFFSET
  substr_sjis EXPR, OFFSET, LENGTH, REPLACEMENT
  substr_sjis EXPR, OFFSET, LENGTH
  substr_sjis EXPR, OFFSET
  $text   = substr_euc($line,13,6);     # eucです。
  $text   = substr_euc($line,6,4,"文字");       # これはeuc文字です。...
  $text   = substr_euc($line,-1,5,"ない")."\n"; # ...sjisではない。

substr() for Japanese Characters.

index_euc / index_sjis

  index_euc  STR, SUBSTR, OFFSET
  index_euc  STR, SUBSTR
  index_sjis STR, SUBSTR, OFFSET
  index_sjis STR, SUBSTR
  $index  = index_euc($line,jcode("テキスト")->euc);    # 6
  $index  = index_euc($line,jcode("テキスト")->euc,9);  # -1

index() for Japanese Characters.

rindex_euc / rindex_sjis

  rindex_euc  STR, SUBSTR, OFFSET
  rindex_euc  STR, SUBSTR
  rindex_sjis STR, SUBSTR, OFFSET
  rindex_sjis STR, SUBSTR
  $rindex = rindex_euc($line,jcode("euc")->euc);                # 13
  $rindex = rindex_euc($line,jcode("euc")->euc,30);     # -1

rindex() for Japanese Characters.


AUTHOR

Yuki SHIMAZU <y.shimazu@nifty.com>