Skip to content

Instantly share code, notes, and snippets.

@randomtestfive
Created April 2, 2017 23:21
Show Gist options
  • Select an option

  • Save randomtestfive/777b41631c52b9b7b9d062f289634246 to your computer and use it in GitHub Desktop.

Select an option

Save randomtestfive/777b41631c52b9b7b9d062f289634246 to your computer and use it in GitHub Desktop.
package csvconvert;
import java.util.Scanner;
public class Convert
{
public static void main(String[] args)
{
//change /frccsv.csv to filename (absolute)
Scanner s = new Scanner(Convert.class.getResourceAsStream("/frccsv.csv"));
s.useDelimiter("");
int sx = 0;
int x = 0;
int y = 160;
System.out.print("placeBot.tiles = [");
String o = "";
while(s.hasNextLine())
{
String q = s.nextLine();
String[] v = q.split(",");
for(String p : v)
{
o+="[" + x + "," + y + "," + p + "],";
x++;
}
x = sx;
y++;
}
s.close();
o = o.substring(0, o.length()-1);
System.out.println(o + "];");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment