[PHP-doc 607] Re: mb_strpos

HOTTA Michihide hotta @ net-newbie.com
2006年 2月 25日 (土) 12:33:27 JST


堀田@長崎市です。

On Fri, 24 Feb 2006 21:11:47 +0900 
Subject: [PHP-doc 606] Re: mb_strpos
TAKAGI Masahiro <matakagi @ osk2.3web.ne.jp> wrote:

> ……と長々と書いてしまいましたが、現在の日本語マニュアルの記述
> が意味不明であることには完全に同意します。さて、どのように直せ
> ばよいでしょうか。どなたかいい案はありませんか?

個人的にはあんまり意味不明とは思わなかったのですが、せっかくなの
でスクラッチから試訳してみました。適宜取捨選択してください。

mb_strpos

(PHP 4 >= 4.0.6, PHP 5)
mb_strpos --  Find position of first occurrence of string in a 
  string Description
int mb_strpos ( string haystack, string needle 
  [, int offset [, string encoding]] )
mb_strpos() returns the numeric position of the first occurrence 
of needle in the haystack string. If needle is not found, it 
returns FALSE.

mb_strpos() performs multi-byte safe strpos() operation based on 
number of characters. needle position is counted from the 
beginning of the haystack. First character's position is 0. 
Second character position is 1, and so on.

If encoding is omitted, internal character encoding is used. 
mb_strrpos() accepts string for needle where strrpos() accepts 
only character.

offset is search offset. If it is not specified, 0 is used.

encoding is character encoding name. If it is omitted, internal 
character encoding is used.

See also mb_strrpos(), mb_internal_encoding(), strpos() 

mb_strpos --  ある文字列の中で指定した文字列が最初に現れる場所を
見つける。

int mb_strpos ( string haystack, string needle 
  [, int offset [, string encoding]] )

mb_strpos() は haystack(干し草) で指定された文字列の中で needle
(針) が最初に見つかった場所を数字で返します。needle が見つからな
い場合は FALSE を返します。

mb_strpos() は、単純な文字数(通常はバイト数と等しい)に基づいて動
作する strpos() を、マルチバイト文字列に対しても正しく動作するよ
うに拡張したものです。needle の位置を haystack の頭から順に数え
ていきます。先頭文字の位置は 0 、2 番目の文字は 1 という具合です。

encoding 指定がない場合、内部エンコーディングの値が使われます。
strrpos() が needle に文字しか受け付けないのに対して、
mb_strrpos() は文字列を指定できます。

offset は検索時のオフセットで、指定されない場合 0 となります。

encoding は文字エンコーディングの名前です。省略された場合、内部
エンコーディングが使われます。

mb_strrpos(), mb_internal_encoding(), strpos() も参照してください。

-- 
〒851-2195 長崎県西彼杵郡長与町まなび野1-1-1
県立長崎シーボルト大学 情報センター 堀田 倫英 <hotta @ sun.ac.jp>
TEL/FAX 095-813-5162  内線:4212



PHP-doc メーリングリストの案内