Estadísticas del código: Devolver el contenido de una cadena que se encuentre entre dos caracteres recibidos - Python

Imágen de perfil
Val: 1.703
Plata
Ha mantenido su posición en Python (en relación al último mes)
Gráfica de Python

Devolver el contenido de una cadena que se encuentre entre dos caracteres recibidos


Python

Publicado el 28 de Diciembre del 2019 por Katas (150 códigos)
1.008 visualizaciones desde el 28 de Diciembre del 2019
Crear una función que recibe una cadena y dos valores a buscar dentro de la cadena, de los cuales tiene que devolver el contenido introducido entre los valores recibos.
Si alguno de los valores a buscar no existen, devolver una cadena vacía.

1
2
3
4
5
6
7
8
firstStringBetween('This is a [custom] string', '[', ']') # "custom"
firstStringBetween('This is a #custom# string', '#', '#') # "custom"
firstStringBetween('This is a "custom" string', '"', '"') # "custom"
firstStringBetween('This is a custom string', 'is a', 'string') # "custom"
firstStringBetween('This is a custom string', 'This', 'a') # "is"
firstStringBetween('This is a [custom string', '[', ']') # ""
firstStringBetween('This is a [custom] string', '', '') # ""
firstStringBetween('This is a custom string', '*', '*') # ""

50 visualizaciones durante los últimos 90 días


9
0