PHP 8.5.0 Alpha 2 available for testing

mb_ltrim

(PHP 8 >= 8.4.0)

mb_ltrimElimina los espacios (u otros caracteres) del inicio de un string

Descripción

mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string

Realiza una operación ltrim() segura para datos multi-octetos. Elimina los espacios (u otros caracteres) del inicio de un string.

Sin el segundo argumento, mb_ltrim() eliminará los siguientes caracteres:

  • " " (Unicode U+0020), un espacio ordinario.
  • "\t" (Unicode U+0009), una tabulación.
  • "\n" (Unicode U+000A), un salto de línea.
  • "\r" (Unicode U+000D), un retorno de carro.
  • "\0" (Unicode U+0000), el octeto NUL.
  • "\v" (Unicode U+000B), una tabulación vertical.
  • "\f" (Unicode U+000C), un avance de página.
  • "\u00A0" (Unicode U+00A0), un ESPACIO INSÉCABLE.
  • "\u1680" (Unicode U+1680), una MARCA DE ESPACIO OGHAM.
  • "\u2000" (Unicode U+2000), un CUADRADO MEDIO.
  • "\u2001" (Unicode U+2001), un CUADRADO.
  • "\u2002" (Unicode U+2002), un ESPACIO MEDIO.
  • "\u2003" (Unicode U+2003), un ESPACIO CUADRADO.
  • "\u2004" (Unicode U+2004), un ESPACIO DE UN-TERCIO-DE-CUADRADO.
  • "\u2005" (Unicode U+2005), un ESPACIO DE UN-CUARTO-DE-CUADRADO.
  • "\u2006" (Unicode U+2006), un ESPACIO DE UN-SEXTO-DE-CUADRADO.
  • "\u2007" (Unicode U+2007), un ESPACIO PARA DÍGITOS.
  • "\u2008" (Unicode U+2008), un ESPACIO DE PUNTUACIÓN.
  • "\u2009" (Unicode U+2009), un ESPACIO FINO.
  • "\u200A" (Unicode U+200A), un ESPACIO PELUDO.
  • "\u2028" (Unicode U+2028), un SEPARADOR DE LÍNEA.
  • "\u2029" (Unicode U+2029), un SEPARADOR DE PÁRRAFO.
  • "\u202F" (Unicode U+202F), un ESPACIO INSÉCABLE ESTRECHO.
  • "\u205F" (Unicode U+205F), un ESPACIO MATEMÁTICO MEDIO.
  • "\u3000" (Unicode U+3000), un ESPACIO IDEOGRÁFICO.
  • "\u0085" (Unicode U+0085), una LÍNEA SIGUIENTE (NEL).
  • "\u180E" (Unicode U+180E), un SEPARADOR DE VOCALES MONGOL.

Parámetros

string
El string de entrada.
characters
Opcionalmente, los caracteres a eliminar también pueden ser especificados utilizando el parámetro characters. Basta con listar todos los caracteres a eliminar.
encoding

The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used.

Valores devueltos

Esta función devuelve un string con los espacios eliminados del inicio de string.

Ver también

  • mb_trim() - Elimina los espacios (u otros caracteres) del inicio y final de un string
  • mb_rtrim() - Elimina los espacios (u otros caracteres) del final de un string
  • ltrim() - Elimina los espacios (u otros caracteres) del inicio de un string
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top