mirror of
https://github.com/php/doc-es.git
synced 2026-03-24 07:22:16 +01:00
170 lines
5.0 KiB
XML
170 lines
5.0 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: ca4b9d11a25fc9f8dde7561c504ed466ed1d6c63 Maintainer: PhilDaiguille Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xml:id="function.mb-strimwidth" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>mb_strimwidth</refname>
|
|
<refpurpose>Trunca una cadena</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>mb_strimwidth</methodname>
|
|
<methodparam><type>string</type><parameter>string</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>start</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>width</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>trim_marker</parameter><initializer>""</initializer></methodparam>
|
|
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>encoding</parameter><initializer>&null;</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Trunca la cadena <parameter>string</parameter> a la longitud
|
|
<parameter>width</parameter> especificada,
|
|
donde los caracteres de media caja cuentan como <literal>1</literal>, y
|
|
los caracteres de caja completa cuentan como <literal>2</literal>.
|
|
Ver <link xlink:href="&url.unicode.reports.tr;11/">&url.unicode.reports.tr;11/</link>
|
|
para más detalles sobre las cajas de caracteres asiáticos del este.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>string</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La cadena a truncar.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>start</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
<parameter>start</parameter> es la posición de inicio, en número
|
|
de caracteres desde el principio de la cadena (el primer carácter es 0),
|
|
o si la posición es negativa, número de caracteres desde el final de la &string;.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>width</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La anchura de la truncación deseada.
|
|
Si se especifica una anchura negativa, debe contarse desde el final de la cadena.
|
|
<note>
|
|
<para>
|
|
Proporcionar una anchura negativa está obsoleto a partir de PHP 8.3.0.
|
|
</para>
|
|
</note>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>trim_marker</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
<parameter>trim_marker</parameter> es la cadena añadida al final de la cadena truncada.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>encoding</parameter></term>
|
|
<listitem>
|
|
&mbstring.encoding.parameter;
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
La cadena truncada. Si <parameter>trim_marker</parameter> está definido,
|
|
<parameter>trim_marker</parameter> reemplaza los últimos caracteres para corresponder al tamaño <parameter>width</parameter>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>8.3.0</entry>
|
|
<entry>
|
|
Proporcionar una <parameter>width</parameter> negativa a
|
|
<function>mb_strimwidth</function> ahora está obsoleto.
|
|
</entry>
|
|
</row>
|
|
&mbstring.changelog.encoding-nullable;
|
|
<row>
|
|
<entry>7.1.0</entry>
|
|
<entry>
|
|
Se añadió soporte para <parameter>start</parameter>s y <parameter>width</parameter>s negativos.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo con <function>mb_strimwidth</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
echo mb_strimwidth("Hello World", 0, 10, "...");
|
|
// Muestra: "Hello W..."
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>mb_strwidth</function></member>
|
|
<member><function>mb_internal_encoding</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
|
|
-->
|