13. Funciones para modificar strings en PHP

Videotutorial Nº 13 del Curso de PHP y MySQL donde se tratan las funciones para manipular strings (cadenas de texto), con ellas podemos formatear y modificar strings.
Como referencia rápida, aquí os pongo algunas de las funciones que tratan con strings y una pequeña descripción:
addcslashes — Escapa una cadena de la misma forma que lo hace C
addslashes — Añade barras invertidas a una cadena
bin2hex — Convierte datos binarios en su representación hexadecimal
chop — Alias de rtrim
chr — Devuelve un caracter específico
chunk_split — Divide una cadena en trozos más pequeños
convert_cyr_string — Convierte de un conjunto de caracteres cirílico a otro conjunto de caracteres cirílico
convert_uudecode — Descodifica una cadena codificada mediante uuencode
convert_uuencode — Codifica, mediante uuencode, una cadena
count_chars — Devuelve información sobre los caracteres usados en una cadena
crc32 — Calcula el polinomio crc32 de una cadena
echo — Muestra una o más cadenas
explode — Split a string by string
fprintf — Escribir una cadena con formato a una secuencia
get_html_translation_table — Returns the translation table used by htmlspecialchars and htmlentities
hebrev — Convierte texto hebreo lógico a texto visual
hebrevc — Convert logical Hebrew text to visual text with newline conversion
html_entity_decode — Convierte todas las entidades HTML a sus caracteres correspondientes
htmlentities — Convert all applicable characters to HTML entities
htmlspecialchars_decode — Convert special HTML entities back to characters
htmlspecialchars — Convert special characters to HTML entities
implode — Une elementos de un array en una cadena
join — Alias de implode
levenshtein — Calculate Levenshtein distance between two strings
localeconv — Obtener información sobre el formato numérico
ltrim — Strip whitespace (or other characters) from the beginning of a string
md5_file — Calcula el resumen criptográfico md5 de un archivo dado
md5 — Calculate the md5 hash of a string
metaphone — Calculate the metaphone key of a stringmoney_format — Formats a number as a currency string
nl_langinfo — Query language and locale information
nl2br — Inserts HTML line breaks before all newlines in a string
number_format — Format a number with grouped thousands
ord — devuelve el valor ASCII de una caracter
parse_str — Parses the string into variables
print — Output a string
printf — Imprimir una cadena con formato
quoted_printable_decode — Convert a quoted-printable string to an 8 bit string
quoted_printable_encode — Convert a 8 bit string to a quoted-printable string
quotemeta — Quote meta characters
rtrim — Strip whitespace (or other characters) from the end of a string
setlocale — Set locale information
sha1_file — Calculate the sha1 hash of a file
sha1 — Calculate the sha1 hash of a string
similar_text — Calculate the similarity between two strings
soundex — Calculate the soundex key of a string
sprintf — Return a formatted string
sscanf — Parses input from a string according to a format
str_getcsv — Parse a CSV string into an array
str_ireplace — Case-insensitive version of str_replace.
str_pad — Pad a string to a certain length with another string
str_repeat — Repeat a string
str_replace — Replace all occurrences of the search string with the replacement string
str_rot13 — Realizar la transformación rot13 sobre una cadena
str_shuffle — Reordena aleatoriamente una cadena
str_split — Convert a string to an array
str_word_count — Return information about words used in a string
strcasecmp — Binary safe case-insensitive string comparison
strchr — Alias de strstr
strcmp — Binary safe string comparison
strcoll — Comparación de cadenas basada en la localidad
strcspn — Find length of initial segment not matching mask
strip_tags — Strip HTML and PHP tags from a string
stripcslashes — Desmarca la cadena marcada con addcslashes
stripos — Find position of first occurrence of a case-insensitive string
stripslashes — Un-quotes a quoted string
stristr — Case-insensitive strstr
strlen — Obtiene la longitud de una cadena
strnatcasecmp — Case insensitive string comparisons using a “natural order” algorithm
strnatcmp — String comparisons using a “natural order” algorithm
strncasecmp — Comparación de los primeros n caracteres de cadenas, segura con material binario e insensible a mayúsculas y minúsculas
strncmp — Binary safe string comparison of the first n characters
strpbrk — Buscar una cadena por cualquiera de los elementos de un conjunto de caracteres
strpos — Busca la posición de la primera ocurrencia de una cadena
strrchr — Find the last occurrence of a character in a string
strrev — Invierte una string
strripos — Find position of last occurrence of a case-insensitive string in a string
strrpos — Find the position of the last occurrence of a substring in a string
strspn — Finds the length of the first segment of a string consisting entirely of characters contained within a given mask.
strstr — Find first occurrence of a string
strtok — Tokenize string
strtolower — Convierte una cadena a minúsculas
strtoupper — Make a string uppercase
strtr — Traduce ciertos caracteres
substr_compare — Binary safe comparison of two strings from an offset, up to length characters
substr_count — Count the number of substring occurrences
substr_replace — Replace text within a portion of a string
substr — Devuelve parte de una cadena
trim — Strip whitespace (or other characters) from the beginning and end of a string
ucfirst — Convierte el primer caracter de una cadena a mayúsculas
ucwords — Convierte a mayúsculas el primer caracter de cada palabra en una cadena
vfprintf — Write a formatted string to a stream
vprintf — Muestra una cadena con formato
vsprintf — Devuelve una cadena con formato

Temática: Programación

Nivel: Avanzado

Publicaciones relacionadas

Deja un comentario