Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
Dividir rutas y hashes en 2 variables diferentes

tengo una variable La variable se ve así:

 path1/path2,hash path1/path2,hash path1/path2,hash path1/path2,hash

etcétera etcétera.

¿Cómo obtengo 2 variables diferentes, una que contiene las rutas y la otra que contiene los hash?

Por ejemplo, las rutas serán así:

 path/path path/path path/path path/path

Soy nuevo en javascript por cierto, lo siento.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Si lo entiendo correctamente, desea dividir todo el contenido en dos cadenas de varias líneas, entonces esta paz de código podría ayudarlo.

 let arrOfPathAndHash = `path1/path2,hash path1/path2,hash path1/path2,hash path1/path2,hash`.split('\n'); arrOfPathAndHash = arrOfPathAndHash.map((pathAndHash) => pathAndHash.split(',')); const paths = arrOfPathAndHash.map((pathAndHash) => pathAndHash[0]).join('\n'); // path1/path2 // path1/path2 // path1/path2 // path1/path2 const hashes = arrOfPathAndHash.map((pathAndHash) => pathAndHash[1]).join('\n'); // hash // hash // hash // hash
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!