RecordSet

Hi,

I used to buid an ador.recordset in vbasic, i wan't to know if at Java there are some object like it?

I need to save some string that were tokenized but not all strings of original string.

StringTokenizer stCampo=new StringTokenizer(cadenaCompleta,"\t\r\n");

int iCuentaTokensPorLinea=0;

String sValor=new String();

char caracter;

char caracter2;

char caracter3;

boolean bEsFecha=false;

boolean bEsNumero=false;

try{

while(stCampo.hasMoreTokens()){

sValor=stCampo.nextToken();

if (sValor.equals("INICIO")){

iCuentaTokensPorLinea=1;

}else{

iCuentaTokensPorLinea++;

}

if (iCuentaTokensPorLinea>=23){

try{

caracter=sValor.charAt(2);

}catch(StringIndexOutOfBoundsException soobe){

caracter=' ' ;

}

if (caracter==47){// THE SLASH / TO SEPARATE DATES DD/MM/AAAA

bEsFecha=true;

}

else{

bEsFecha=false;

if (Character.isDigit(caracter2) && Character.isDigit(caracter3)){

bEsNumero=true;

}

else{

bEsNumero=false;

}

}

if (bEsNumero || bEsNumero){

// here need to save the string sValor in something like a table

}

Thanks

[2834 byte] By [kaminante11a] at [2007-11-27 4:00:47]
# 1

Hope you have to keep it for further use.

You can use Dynamic array like ArrayList or Vector for this purpose.

ArrayList will be best option.

below the code:

StringTokenizer stCampo=new StringTokenizer(cadenaCompleta,"\t\r\n");

java.util.ArrayList arrayList = new java.util.ArrayList() ;

int iCuentaTokensPorLinea=0;

String sValor=new String();

char caracter;

char caracter2;

char caracter3;

boolean bEsFecha=false;

boolean bEsNumero=false;

try{

while(stCampo.hasMoreTokens()){

sValor=stCampo.nextToken();

if (sValor.equals("INICIO")){

iCuentaTokensPorLinea=1;

}else{

iCuentaTokensPorLinea++;

}

if (iCuentaTokensPorLinea>=23) {

try{

caracter=sValor.charAt(2);

}catch(StringIndexOutOfBoundsException soobe){

caracter=' ' ;

}

if (caracter==47) { // THE SLASH / TO SEPARATE DATES DD/MM/AAAA

bEsFecha=true;

}

else{

bEsFecha=false;

if (Character.isDigit(caracter2) && Character.isDigit(caracter3)){

bEsNumero=true;

}

else{

bEsNumero=false;

}

}

if (bEsNumero || bEsNumero){

arrayList .add(sValor);

}

FJALOORa at 2007-7-12 9:05:24 > top of Java-index,Java Essentials,Java Programming...