mirror of
https://github.com/php/doc-es.git
synced 2026-03-26 16:32:13 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@334774 c90b9560-bf6c-de11-be94-00142212c4b1
218 lines
5.4 KiB
XML
218 lines
5.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 14af302c9c0e561fa6f9cdd956268758ba9a89c5 Maintainer: jpberdejo Status: ready -->
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.str-word-count">
|
|
<refnamediv>
|
|
<refname>str_word_count</refname>
|
|
<refpurpose>
|
|
Devuelve información sobre las palabras utilizadas en un string
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>mixed</type><methodname>str_word_count</methodname>
|
|
<methodparam><type>string</type><parameter>string</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>format</parameter><initializer>0</initializer></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>charlist</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Cuenta el número de palabras dentro de <parameter>string</parameter>.
|
|
Si no se especifica el <parameter>format</parameter> opcional, entonces
|
|
el valor devuelto será un integer representando el número de palabras
|
|
encontradas. En el caso en que se especifique <parameter>format</parameter>, el valor
|
|
devuelto será un array cuyo contenido depende de
|
|
<parameter>format</parameter>. Los posibles valores para
|
|
<parameter>format</parameter> y las salidas resultantes están listadas más abajo.
|
|
</para>
|
|
<para>
|
|
Para los propósitos de esta función, 'palabra' se define como un string dependiente
|
|
de la configuración regional que contiene caracteres alfabéticos, el cual también puede contener, pero no iniciar
|
|
con los caracteres "'" y "-".
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>string</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
El string
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>format</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Especifica el valor devuelto de esta función. Los valores soportados actualmente
|
|
son:
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara>
|
|
0 - devuelve el número de palabras encontradas
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
1 - devuelve un array que contiene todas las palabras encontradas dentro del
|
|
<parameter>string</parameter>
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
2 - devuelve un array asociativo, donde la clave es la posición
|
|
numérica de una palabra dentro del <parameter>string</parameter> y
|
|
el valor es la palabra en sí.
|
|
</simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>charlist</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Una lista de caracteres adicionales los cuales serán considerados como de 'palabra'.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Devuelve un array o un integer, dependiendo del
|
|
<parameter>format</parameter> seleccionado.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>5.1.0</entry>
|
|
<entry>
|
|
Agregado el parámetro <parameter>charlist</parameter>
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo de <function>str_word_count</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$str = "Hello fri3nd, you're
|
|
looking good today!";
|
|
|
|
print_r(str_word_count($str, 1));
|
|
print_r(str_word_count($str, 2));
|
|
print_r(str_word_count($str, 1, 'àáãç3'));
|
|
|
|
echo str_word_count($str);
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[0] => Hello
|
|
[1] => fri
|
|
[2] => nd
|
|
[3] => you're
|
|
[4] => looking
|
|
[5] => good
|
|
[6] => today
|
|
)
|
|
|
|
Array
|
|
(
|
|
[0] => Hello
|
|
[6] => fri
|
|
[10] => nd
|
|
[14] => you're
|
|
[29] => looking
|
|
[46] => good
|
|
[51] => today
|
|
)
|
|
|
|
Array
|
|
(
|
|
[0] => Hello
|
|
[1] => fri3nd
|
|
[2] => you're
|
|
[3] => looking
|
|
[4] => good
|
|
[5] => today
|
|
)
|
|
|
|
7
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>explode</function></member>
|
|
<member><function>preg_split</function></member>
|
|
<member><function>split</function></member>
|
|
<member><function>count_chars</function></member>
|
|
<member><function>substr_count</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
|
|
-->
|
|
|