Question: I'm trying to change default language of website from "en" to "jp".

The webpage both contain english and japanesse. 

I can't understand japanesse. But chrome translatation always suggest english translation (english to other language) first.

And I have to chage website language to japanesse to translation.

I think change website's default language can help. 

I figure chrome extension like Tampermonkey can override attribute of html.

Here's my code. 

```
// ==UserScript==
// @name default_lang
// @description change site language from en to jp
// @include         https://*siteaddress.com/*
// ==/UserScript==

document.body.innerHTML= document.body.innerHTML.replace(/xml:lang=\"en\" lang=\"en\"/g, "xml:lang=\"jp\" lang=\"jp\"");

```

Hope you could help me.

Answer: 
I am considering your string with delimiter /n 

```
var string="Segment Id : 82394 | Segment Name : SPA FIAT MAR 2020 LKADCLAKSC DEM (Permission)_01 | Segment Count : 0 /n  Segment Id : 82395 | Segment Name : SPA FIAT MAR 2020 LKADCLAKSC DEM (LeadYoung)_02 | Segment Count : 0"

var separatedAsArray=string.split('/n')
var string2=separatedAsArray.toString();

//Output of the above two lines
"Segment Id : 82394 | Segment Name : SPA FIAT MAR 2020 LKADCLAKSC DEM (Permission)_01 | Segment Count : 0 ,  Segment Id : 82395 | Segment Name : SPA FIAT MAR 2020 LKADCLAKSC DEM (LeadYoung)_02 | Segment Count : 0"

var formatedString = string2.split(',');

//Output of the above line is 
["Segment Id : 82394 | Segment Name : SPA FIAT MAR 2020 LKADCLAKSC DEM (Permission)_01 | Segment Count : 0 ", "  Segment Id : 82395 | Segment Name : SPA FIAT MAR 2020 LKADCLAKSC DEM (LeadYoung)_02 | Segment Count : 0"]

formatedString.forEach(function(element) {
var properties = element.split('|');
var obj = {};
properties.forEach(function(ele) {
    var keyValue = ele.split(':');
    obj[keyValue[0]] = keyValue[1];
});
 console.log(obj)
});

//Output of the above code snippet is
{
  Segment Count : " 0 ",
  Segment Name : " SPA FIAT MAR 2020 LKADCLAKSC DEM (Permission)_01 ",
  Segment Id : " 82394 "
}
{
  Segment Id : " 82395 ",
  Segment Count : " 0",
  Segment Name : " SPA FIAT MAR 2020 LKADCLAKSC DEM (LeadYoung)_02 "
}

```

After getting the individual object store them in the array or anywhere you want...
Hello check this version with javascript split() function that pushes every object to an array of objects:

```js
var str = "Segment Id : 82394 | Segment Name : SPA FIAT MAR 2020 LKADCLAKSC DEM (Permission)_01 | Segment Count : 0 Segment Id : 82395 |  Segment Name : SPA FIAT MAR 2020 LKADCLAKSC DEM (LeadYoung)_02 | Segment Count : 0 Segment Id : 82396 |   Segment Name : SPA FIAT MAR 2020 LKADCLAKSC DEM (LeadYoung)_03 | Segment Count : 0";
    let splitted = str.split("|");
    let nextId;
    let arrayOfObjects = [];
    for (let i = 0; i < splitted.length - 2; i = i + 2) {
      let id;
      if (i == 0) id = splitted[0].split(":")[1];
      if (i > 0) id = nextId;
      let name = splitted[i + 1].split(":")[1];
      let count = splitted[i + 2].split(':')[1].split(" ")[1];
      nextId = splitted[i + 2].split(':')[2];
      let singleObject = { SegmentId: null, SegmentName: null, segmentCount: null }
      singleObject.SegmentId = id;
      singleObject.SegmentName = name;
      singleObject.segmentCount = count;
      arrayOfObjects.push(singleObject);
    }
    console.log(arrayOfObjects);
```