add convcsv
This commit is contained in:
parent
063ea5ceae
commit
be17a4910e
1 changed files with 57 additions and 0 deletions
57
javascript/convcsv.html
Normal file
57
javascript/convcsv.html
Normal file
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright (c) 2012 kou029w
|
||||
Licensed under the MIT License.
|
||||
http://kou029w.appspot.com/mit-license.txt
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>t-sat|js</title>
|
||||
<meta charset='utf-8'>
|
||||
<script>
|
||||
function convcsv(){
|
||||
t=document.getElementById("csv");
|
||||
w=t.value.split(/\n/);
|
||||
r=[];
|
||||
for( i=0; i<w.length; i++ ){
|
||||
w[i]=w[i].replace(/^([^,]*,){1}(.*)(,[^,]*){11}$/,"$2").replace(/^[a-z,].*/i,"");
|
||||
if(w[i]!=""){
|
||||
w[i]=w[i].replace(/$/,",0.000000").replace(/([0-9]{5},)/g,".$1");
|
||||
r.push(w[i]);
|
||||
}
|
||||
}
|
||||
document.getElementById("result").value=""+r.join("\n");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<form action="">
|
||||
<textarea id="csv" name="" rows="10" cols="30">Time,Lat,Lon,Age,AccX,AccY,AccZ,GyroX,GyroY,GyroZ,MagX,MagY,MagZ,Msg
|
||||
30091,,,,11,-23,259,,,,,,,
|
||||
30115,,,,,,,-75,63,-9,,,,
|
||||
30134,,,,,,,,,,-264,61,781,
|
||||
30153,3551628,13417210,3,,,,,,,,,,
|
||||
30174,,,,10,-21,260,,,,,,,
|
||||
30193,,,,,,,-94,89,-5,,,,
|
||||
30213,,,,,,,,,,-268,62,778,
|
||||
30231,3551628,13417210,4,,,,,,,,,,
|
||||
30258,,,,9,-19,261,,,,,,,
|
||||
30277,,,,,,,-139,154,8,,,,
|
||||
30296,,,,,,,,,,-272,72,782,
|
||||
30315,,,,0,-30,260,,,,,,,
|
||||
30333,,,,,,,-103,151,56,,,,
|
||||
30353,,,,,,,,,,-290,88,779,
|
||||
30371,3551628,13417210,4,,,,,,,,,,
|
||||
30403,,,,-27,-61,252,,,,,,,
|
||||
30423,,,,,,,13,-74,43,,,,
|
||||
30447,,,,,,,,,,-290,88,779,
|
||||
30466,3551628,13417210,3,,,,,,,,,,
|
||||
30487,,,,3,-31,256,,,,,,,
|
||||
30505,,,,,,,-25,-12,-2,,,,
|
||||
30525,,,,,,,,,,-279,83,783,
|
||||
30543,3551628,13417210,4,,,,,,,,,,</textarea>
|
||||
<input type="button" value="convcsv" onClick="convcsv()">
|
||||
<textarea id="result" name="" rows="10" cols="30"></textarea>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Reference in a new issue