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

147
Views
Convierta una matriz de cadenas en una cadena para el csv

Tengo la siguiente matriz de cadenas.

 const test = ["Date,type,user,Account,Desc\r", "1 jan 2021,RR,GK,,Testing acc\r", "1 jan 2021,RR,GK,,Testing acc\r", "1 jan 2021,RR,GK,,Testing acc\r", "1 jan 2021,RR,GK,,Testing acc\r"]

Ahora estoy tratando de convertir esta matriz de cadenas en una sola cadena que luego se puede usar para la creación de CSV.

Así que probé test.toString() que resultó en

 "Date,type,user,Account,Desc ,1 jan 2021,RR,GK,,Testing acc ,1 jan 2021,RR,GK,,Testing acc ,1 jan 2021,RR,GK,,Testing acc ,1 jan 2021,RR,GK,,Testing acc " After using this data for CSV creation , it is actually skipping one column means Date date gets added in the next column and last data which is Testing acc does not contain any header it should have been Desc.

Si elimino el , antes del 1 jan 2021 , toma todas las columnas correctamente, pero la fecha debería haber sido ###### en su lugar, toma el valor original.

Cómo puedo solucionar esto ?

Gracias

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Intenta usar el método de unión:

 const separator = '\n'; // or select enother value test.join(separator)

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join

about 4 years ago · Juan Pablo Isaza 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!