I am working with a CSV file that looks like this https://plus.google.com/u/0/photos/photo/115135191238195349859/6559552907258825106
as you can see in the coloum "date_sold" there are gaps
I am trying to shorten the dates to just the month (the first two ints of the whole date with this method:
public static void getTotalSales(){
int w = 0;
while (w < date_sold.size()){
// if the current element is smaller than the size of the
if((date_sold.get(w)) != "" ){
// if the element in the array is empty (might be the problem)
date_sold.set(w,((date_sold.get(w)).substring(0,2)));
// trim the string at the element to two characters
}
w = w + 1;
}
System.out.println(date_sold);
}
This prints out working for the first element from "date_sold" to "da" but then I get a
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range
I would like to skip over empty elements but not get rid of them as the indexing of empty elements is important to me