1
0
mirror of https://github.com/php/doc-ja.git synced 2026-04-25 00:48:05 +02:00
Files
archived-doc-ja/reference/strings/functions/ucwords.xml
T
Yoshinari Takaoka f9806508ce Updates for RFC: Locale-independent case conversion
* Add a detailed description of what is meant by ASCII case conversion
  to strtolower() and strtoupper().
* Replace locale-related text on ucfirst(), lcfirst() and ucwords()
  with text about ASCII case conversion.
* Remove entity note.locale-single-byte since it was only used on
  ucwords().
* Add changelog entries to all the functions mentioned in the RFC.

https://github.com/php/doc-en/commit/54ff7bf8e0f8fa90988cccf6b583517366605f6d
2022-11-08 21:58:34 +09:00

178 lines
4.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 54ff7bf8e0f8fa90988cccf6b583517366605f6d Maintainer: hirokawa Status: ready -->
<!-- CREDITS: shimooka,mumumu -->
<refentry xml:id="function.ucwords" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>ucwords</refname>
<refpurpose>文字列の各単語の最初の文字を大文字にする</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>ucwords</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>separators</parameter><initializer>" \t\r\n\f\v"</initializer></methodparam>
</methodsynopsis>
<para>
文字が <literal>"a"</literal> (0x61) から <literal>"z"</literal>
(0x7a) までのアルファベットの場合、
<parameter>string</parameter>
の各単語の最初の文字を大文字にしたものを返します。
</para>
<para>
この関数における "単語" とは、
<parameter>separators</parameter>
に含まれていない文字からなる文字列です。
<parameter>separators</parameter> のデフォルトはスペース、
フォームフィード、改行、キャリッジリターン、
水平タブ、垂直タブ です。
</para>
<para>
マルチバイト文字列に対して類似の変換を行うには、
<function>mb_convert_case</function>
<constant>MB_CASE_TITLE</constant> モードで使います。
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>string</parameter></term>
<listitem>
<para>
入力文字列。
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>separators</parameter></term>
<listitem>
<para>
オプションの <parameter>separators</parameter> で、単語の区切り文字を指定します。
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
変更後の文字列を返します。
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&strings.changelog.ascii-case-conversion;
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>ucwords</function> の例</title>
<programlisting role="php">
<![CDATA[
<?php
$foo = 'hello world!';
$foo = ucwords($foo); // Hello World!
$bar = 'HELLO WORLD!';
$bar = ucwords($bar); // HELLO WORLD!
$bar = ucwords(strtolower($bar)); // Hello World!
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title><function>ucwords</function> で、区切り文字を指定する例</title>
<programlisting role="php">
<![CDATA[
<?php
$foo = 'hello|world!';
$bar = ucwords($foo); // Hello|world!
$baz = ucwords($foo, "|"); // Hello|World!
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title><function>ucwords</function> で、追加の区切り文字を指定する例</title>
<programlisting role="php">
<![CDATA[
<?php
$foo = "mike o'hara";
$bar = ucwords($foo); // Mike O'hara
$baz = ucwords($foo, " \t\r\n\f\v'"); // Mike O'Hara
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
&note.bin-safe;
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>strtoupper</function></member>
<member><function>strtolower</function></member>
<member><function>ucfirst</function></member>
<member><function>mb_convert_case</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->