我将这个前端CSS数据存储在网页中。这是文本文件中的数据。
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Http.WebHost" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.2.0.0" newVersion="3.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Common.Logging.Core" publicKeyToken="af08829b84f0328e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.2.0.0" newVersion="3.2.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
我需要将此文本文件转换为以下格式。一旦,我将其转换为以下格式,我将能够在前端显示它。以下格式用于在jqgrid中显示数据。
secid,Initial_shares
002826,3777
0028262,3777
0028262,3777
0028262,3777
0028262,3777
0028262,3777
为了将文本转换为上面的格式,我使用了下面的perl代码。请注意。此转换是静态的。即它知道有多少列。在这种情况下,将有2列。 secid和Initial_shares。所以这里是静态代码
var secid =
[
"002826", "0028262", "0028262", "0028262", "0028262", "0028262"];
var Initial_shares =
[
"3777", "3777", "3777", "3777", "3777", "3777"1
];
@perl_array将与我们在开始时期望的那种数据完全相似。我将把这个perl变量转移到前端以便显示。
在以下情况下我需要帮助。如果不是2列,则有5列。我们如何将相同的csv文件转换为前面提到的格式。它应该都是动态的。有人可以说清楚。