|
|
Línia 1: |
Línia 1: |
− | Alguns dels mètodes que ofereixen les cadenes són: | + | * Alguns dels mètodes que ofereixen les cadenes són: |
| | | |
| '''capitalize()''' – Canvia totes les lletres de cadena a majúscules. | | '''capitalize()''' – Canvia totes les lletres de cadena a majúscules. |
Línia 37: |
Línia 37: |
| isspace() – does the string consists only of white spaces? | | isspace() – does the string consists only of white spaces? |
| isupper() – does the string consists only of upper-case letters? | | isupper() – does the string consists only of upper-case letters? |
− | startswith() – does the string begin with a given substring? – joins all items of a tuple/list into one string; | + | startswith() – does the string begin with a given substring? |
− | lower() – converts all the string's letters into lower-case letters;
| |
− | lstrip() – removes the white characters from the beginning of the string;
| |
− | replace() – replaces a given substring with another;
| |
− | rfind() – finds a substring starting from the end of the string;
| |
− | rstrip() – removes the trailing white spaces from the end of the string;
| |
− | split() – splits the string into a substring using a given delimiter;
| |
− | strip() – removes the leading and trailing white spaces;
| |
− | swapcase() – swaps the letters' cases (lower to upper and vice versa)
| |
− | title() – makes the first letter in each word upper-case;
| |
− | upper() – converts all the string's letter into upper-case letters.
| |
| | | |
− | 2. String content can be determined using the following methods (all of them return Boolean values):
| + | * El contingut de la cadena es pot determinar utilitzant els següents mètodes (tots ells retornen valors booleans): |
− | | |
− | endswith() – does the string end with a given substring?
| |
− | isalnum() – does the string consist only of letters and digits?
| |
− | isalpha() – does the string consist only of letters?
| |
− | islower() – does the string consists only of lower-case letters?
| |
− | isspace() – does the string consists only of white spaces?
| |
− | isupper() – does the string consists only of upper-case letters?
| |
− | startswith() – does the string begin with a given substring?join() – joins all items of a tuple/list into one string;
| |
− | lower() – converts all the string's letters into lower-case letters;
| |
− | lstrip() – removes the white characters from the beginning of the string;
| |
− | replace() – replaces a given substring with another;
| |
− | rfind() – finds a substring starting from the end of the string;
| |
− | rstrip() – removes the trailing white spaces from the end of the string;
| |
− | split() – splits the string into a substring using a given delimiter;
| |
− | strip() – removes the leading and trailing white spaces;
| |
− | swapcase() – swaps the letters' cases (lower to upper and vice versa)
| |
− | title() – makes the first letter in each word upper-case;
| |
− | upper() – converts all the string's letter into upper-case letters.
| |
− | | |
− | 2. String content can be determined using the following methods (all of them return Boolean values):
| |
− | | |
− | endswith() – does the string end with a given substring?
| |
− | isalnum() – does the string consist only of letters and digits?
| |
− | isalpha() – does the string consist only of letters?
| |
− | islower() – does the string consists only of lower-case letters?
| |
− | isspace() – does the string consists only of white spaces?
| |
− | isupper() – does the string consists only of upper-case letters?
| |
− | startswith() – does the string begin with a given substring?join() – joins all items of a tuple/list into one string;
| |
− | lower() – converts all the string's letters into lower-case letters;
| |
− | lstrip() – removes the white characters from the beginning of the string;
| |
− | replace() – replaces a given substring with another;
| |
− | rfind() – finds a substring starting from the end of the string;
| |
− | rstrip() – removes the trailing white spaces from the end of the string;
| |
− | split() – splits the string into a substring using a given delimiter;
| |
− | strip() – removes the leading and trailing white spaces;
| |
− | swapcase() – swaps the letters' cases (lower to upper and vice versa)
| |
− | title() – makes the first letter in each word upper-case;
| |
− | upper() – converts all the string's letter into upper-case letters.
| |
− | | |
− | 2. String content can be determined using the following methods (all of them return Boolean values):
| |
| | | |
− | endswith() – does the string end with a given substring? | + | '''endswith()''' – la cadena acaba amb una subcadena determinada? |
− | isalnum() – does the string consist only of letters and digits? | + | '''isalnum()''' – la cadena només consisteix en lletres i números? |
− | isalpha() – does the string consist only of letters? | + | '''isalpha()''' – la cadena només consisteix en lletres? |
− | islower() – does the string consists only of lower-case letters? | + | '''islower()''' – la cadena només consisteix en lletres minúscules? |
− | isspace() – does the string consists only of white spaces? | + | '''isspace()''' – la cadena només consisteix en espais en blanc? |
− | isupper() – does the string consists only of upper-case letters? | + | '''isupper()''' – la cadena només consisteix en lletres majúscules? |
− | startswith() – does the string begin with a given substring?join() – joins all items of a tuple/list into one string;
| + | '''startwith()''' – la cadena comença amb una subcadena determinada? |
− | lower() – converts all the string's letters into lower-case letters;
| |
− | lstrip() – removes the white characters from the beginning of the string;
| |
− | replace() – replaces a given substring with another;
| |
− | rfind() – finds a substring starting from the end of the string;
| |
− | rstrip() – removes the trailing white spaces from the end of the string;
| |
− | split() – splits the string into a substring using a given delimiter;
| |
− | strip() – removes the leading and trailing white spaces;
| |
− | swapcase() – swaps the letters' cases (lower to upper and vice versa)
| |
− | title() – makes the first letter in each word upper-case;
| |
− | upper() – converts all the string's letter into upper-case letters.
| |
− | | |
− | 2. String content can be determined using the following methods (all of them return Boolean values):
| |
− | | |
− | endswith() – does the string end with a given substring?
| |
− | isalnum() – does the string consist only of letters and digits?
| |
− | isalpha() – does the string consist only of letters?
| |
− | islower() – does the string consists only of lower-case letters?
| |
− | isspace() – does the string consists only of white spaces?
| |
− | isupper() – does the string consists only of upper-case letters?
| |
− | startswith() – does the string begin with a given substring?
| |
- Alguns dels mètodes que ofereixen les cadenes són:
capitalize() – Canvia totes les lletres de cadena a majúscules.
center() – centra la cadena dins del camp d'una longitud coneguda.
count() – compta el nombre de cops que hi apareix a una cadena un caràcter donat.
join() – uneix tots els elements d'una tupla/llista en una sola cadena.
lower() – converteix totes les lletres de la cadena en lletres minúscules.
lstrip() – elimina els caràcters blancs del començament de la cadena.
replace() – substitueix una subcadena donada per una altra.
rfind() – troba una subcadena que comença des del final de la cadena;.
rstrip() – elimina els espais en blanc finals del final de la cadena.
split() – divideix la cadena en una subcadena emprant un delimitador donat.
strip() – elimina els espais en blanc inicials i finals.
swapcase() – Intercanvia les majúscules per minúscules i viceversa.
title() – fa la primera lletra en cada paraula en majúscules.
upper() – converteix totes les lletres de la cadena en majúscules.
2. String content can be determined using the following methods (all of them return Boolean values):
endswith() – does the string end with a given substring?
isalnum() – does the string consist only of letters and digits?
isalpha() – does the string consist only of letters?
islower() – does the string consists only of lower-case letters?
isspace() – does the string consists only of white spaces?
isupper() – does the string consists only of upper-case letters?
startswith() – does the string begin with a given substring?
- El contingut de la cadena es pot determinar utilitzant els següents mètodes (tots ells retornen valors booleans):
endswith() – la cadena acaba amb una subcadena determinada?
isalnum() – la cadena només consisteix en lletres i números?
isalpha() – la cadena només consisteix en lletres?
islower() – la cadena només consisteix en lletres minúscules?
isspace() – la cadena només consisteix en espais en blanc?
isupper() – la cadena només consisteix en lletres majúscules?
startwith() – la cadena comença amb una subcadena determinada?