-2

I have a text document with questions and answers, there are 10,000 of them, for an example I will add a few below

'
Severe cold | cold
A heavy massive vessel in which they pound with a pestle.|stupa
Monumental religious building in Indian architecture.|stupa
Commercial fish of the perch family.|zander
'

we have questions here and after the sign "|" answers

I need to convert to this format

['Severe cold'],['cold'],
['A heavy massive vessel in which they pound with a pestle'],['stupa'],
['Monumental religious building in Indian architecture'],['stupa'],
['Commercial fish of the perch family'],['zander']
Eduard
  • 27
  • 5

1 Answers1

0

I think string.split() might be what you're looking for:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split

let arr = txt.split("|")

In your case

Jacob Stephenson
  • 544
  • 3
  • 13