-1
我應該檢查csv
文件的數據是否正確,如果他們用逗號即使在一個字符串引號分割正確,我沒有解析,因爲這是已經被別人做了正確的因爲在使用該csv
期間創建圖表,我必須做出只有數據的正確性進行驗證,如果用戶上傳文件。檢查CSV數據與JavaScript
我該怎麼辦?
這是html代碼:
<!-- Adding CSV data to the document -->
<head>
<script id="cur_data" type="text/csv">
Russian Federation, Italy, France, Luxembourg, Greece, Japan, Others
293, 302, 91, 7, 7, 7, 53
</script>
</head>
<body>
<!-- Sections -->
<div class="section">
<h1>Figures</h1>
<div id="figure_1" class="picture">
<p class="img_block">
<img src="#cur_data" class="horizontal_bar_chart" alt="Let's graph it!"></img>
</p>
<p class="caption">Caption of the figure.</p>
</div>
</div>
</body>
http://stackoverflow.com/questions/2450345/how-to-validate-csv-file –