Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

285
Vistas
How can I delete a specific character from each string in an array in React native?

I have a string in an array called imgss . At this time, I want to subtract only the number from the string and put it in the answer variable. So imgss copied and then splice was written, but it does not work as there may be multiple numbers. How do I fix my code?

this is my code

    const imgss = ["ecdysisInfo 1", "growthLength 2", "wormHeadSize 1234"]


    const image = [...imgss]

    image.splice(0, 2);

    expected answer 

    const answer = ["ecdysisInfo", "growthLength", "wormHeadSize"]
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can split each item with space

const imgss = ["ecdysisInfo 1", "growthLength 2", "wormHeadSize 1234"]

const image = imgss.map((item) => item.split(' ')[0]);

console.log(image)

OR you can use replace and regex to remove all numbers and spaces

const imgss = ["ecdysisInfo 1", "growthLength 2", "wormHeadSize 1234"]

const result = imgss.map((item) => item.replace(/[0-9 ]/g, ''));

console.log(result);

about 4 years ago · Juan Pablo Isaza Denunciar

0

here is what I did :

const imgss = ["ecdysisInfo 1", "growthLength 2", "wormHeadSize 1234"]
    const answer = imgss.map(str=> str.replace(' ','').split('').filter(item=>!item.match(/[0-9]/i)).join(''));
    console.log(answer)

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda