I happen to have large translation file and need to add double quotes to end of the string. My Goal.
input string ===> _your_report_is_being_prepared = Your report is being prepared
desired output ===> "_your_report_is_being_prepared" : "Your report is being prepared"
I happen to have succeeded until this point but it lacks double quote at end of that string.
"_your_report_is_being_prepared " : " Your report is being prepared
// how do i add the double quote to the end of the string above.
function stringManipulator(result){
var finalResult;
//1st step --> split string by newline ('\n')
var str = result.split('\n'); // good.
for (var i = 0; i < str.length; i++) { //because iam handling like 600 lines of text...
// convert the resultArray into string so that i can apply string method like replace
var add_quotes = str[i].toString()
//replace the any occurence of (=) with the (:) using the regex pattern of
add_quotes = add_quotes.replace(/=/g, ":" )
// suppose u split ur string further by : so that u can add the double quotes to seperate strings
var resultA = add_quotes.split(':');
//var y = '"' + resultA[0] + '"' + ':' + '"' + resultA[1] + '"';
// output that i got ==> "_access_folders ":" View folders
var y = '"' + resultA[0] + '"' + ' : ' + '"' + resultA[1] + '"'; //===> close
console.log(y) // "_access_folders ":" View folders
finalResult = y ;
}
return finalResult
}
From the comments below, it have tested the code snippet and it works perefectly well in the browser but not the in nodejs script... yet i wanted to achieve it with nodejs. maybe let edit the question title to reflect nodejs