Subversion Repository Public Repository

litesoft

Diff Revisions 938 vs 939 for /trunk/Java/core/Anywhere/src/org/litesoft/core/util/CsvSupport.java

Diff revisions: vs.
  @@ -1,6 +1,8 @@
1 1 // This Source Code is in the Public Domain per: http://litesoft.org/License.txt
2 2 package org.litesoft.core.util;
3 3
4 + import org.litesoft.commonfoundation.exceptions.*;
5 +
4 6 import java.util.*;
5 7
6 8 /**
  @@ -180,14 +182,15 @@
180 182 }
181 183
182 184 StringBuilder sb = new StringBuilder( sLen + sumLengths( pSource ) );
185 + appendCsvField( pSource[0], sb );
183 186
184 - for ( int i = 0; i < sLen; i++ )
187 + for ( int i = 1; i < sLen; i++ )
185 188 {
186 189 sb.append( ',' );
187 190 appendCsvField( pSource[i], sb );
188 191 }
189 192
190 - return sb.toString().substring( 1 ); // skip initial comma
193 + return sb.toString();
191 194 }
192 195
193 196 /**
  @@ -282,7 +285,7 @@
282 285 int quote = source.indexOf( '"', ++startIndex );
283 286 if ( quote == -1 )
284 287 {
285 - throw new UnclosedQuoteException( "Appearently Quoted Field no closing quote, starting at: " + source );
288 + throw new UnclosedQuoteException( "Apparently Quoted Field no closing quote, starting at: " + source );
286 289 }
287 290
288 291 startIndex = quote + 1;