Click here to Skip to main content
14,391,293 members
Rate this:
Please Sign up or sign in to vote.
See more:
<div id="demo"></div>
	function parseT24Response(data){



	const lines = data.split(',\"');
	const headerline = lines[0];
	const splitHeaderline = headerline.split('/');
	const headers = splitHeaderline.map(x => x.split('::')[1] || x.split(':')[1])
	
	const records = [];
	records.push(headers);

	for (let i = 1; i < lines.length; i++) {

		records.push(lines[i].split("\"\t\""));

	}



	



return records





}







const m = ',D.SCHEDULE.DATE::Date/D.DEFER.DATE::Defer Date/TOT.DUE::Total Due/TOT.CAP::Total Cap/TOTAL.PRINCIPAL::Principal/TOTAL.INTEREST::Interest/TOTAL.CHARGE::Charge/TOTAL.TAX::Tax/TOTAL.PAY::Total Pymt/OUTSTANDING::Outstanding,"04 SEP 2018"	"           "	"           1,000.00"	"               0.00"	"          50,000.00"	"                   "	"           1,000.00"	"                    "	"           50,000.00"	"         -50,000.00","04 OCT 2018"	"           "	"          18,183.33"	"               0.00"	"          16,633.33"	"           1,550.00"	"                   "	"                    "	"                    "	"         -33,366.67","04 NOV 2018"	"           "	"          18,183.33"	"               0.00"	"          16,683.33"	"           1,500.00"	"                   "	"                    "	"                    "	"         -16,683.34","04 DEC 2018"	"           "	"          18,183.34"	"               0.00"	"          16,683.34"	"           1,500.00"	"                   "	"                    "	"                    "	"               0.00"'



const r=parseT24Response(m)









//console.table(r);







    var table = document.createElement("table");

    var tr = document.createElement("tr");

    for(var i = 0; i <r[0].length; i++){

        var th = document.createElement("th");

        th.innerHTML = r[0][i];

        tr.appendChild(th);

    }

  

   

    table.appendChild(tr);

    for(var i = 1; i < r.length; i++){

        var tr = document.createElement("tr");

        for(var j = 0; j < r[0].length; j++){

        	var datas =  r[i][j]







        	//var k=cool(datas);  	

        

        	 



        	



        	//.log(datas);

        

            var td = document.createElement("td");

            td.innerHTML = r[i][j].replace('"', '');

           var  y= r[i][j].replace('"', '')

           

           var datass = new Array(y);

           console.log(y)



            tr.appendChild(td);

            

        }

        table.appendChild(tr);

    }

      document.getElementById("demo").appendChild(table)



      var h = table.innerHTML



  console.log (h)


What I have tried:

So far i am trying to see how to get my head around it
Posted
Updated 1-Jul-19 4:06am
v2

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100