1
0
mirror of https://github.com/php/doc-ja.git synced 2026-03-24 07:02:08 +01:00
Files
Yoshinari Takaoka 4773312462 [ext/strings] followed all updates made on or after November 1, 2024.
- WASM の example 修正
- number_format まわりの誤訳
- その他細かい修正全てに追随

https://github.com/php/doc-en/commits/master/reference/strings
2025-08-23 15:55:59 +09:00

178 lines
4.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 45042fef652f1b4e904e809fcbfcf31f6c60670b 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!';
echo ucwords($foo), PHP_EOL; // Hello World!
$bar = 'HELLO WORLD!';
echo ucwords($bar), PHP_EOL; // HELLO WORLD!
echo ucwords(strtolower($bar)), PHP_EOL; // Hello World!
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title><function>ucwords</function> で、カスタムの区切り文字を指定する例</title>
<programlisting role="php">
<![CDATA[
<?php
$foo = 'hello|world!';
echo ucwords($foo), PHP_EOL; // Hello|world!
echo ucwords($foo, "|"), PHP_EOL; // Hello|World!
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title><function>ucwords</function> で、追加の区切り文字を指定する例</title>
<programlisting role="php">
<![CDATA[
<?php
$foo = "mike o'hara";
echo ucwords($foo), PHP_EOL; // Mike O'hara
echo ucwords($foo, " \t\r\n\f\v'"), PHP_EOL; // 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
-->