¿Cómo incremento un bucle usando formato hexadecimal?Hola,
Quiero crear una lista y completarla con las siguientes entradas: AB63, AB64,... AB79, AC63,...AZ79.
Desafortunadamente, no he podido descubrir cómo incrementar hexadecimalmente ("J" = Hex(4A), etc.)
Entonces, para las letras JO (Hex4A - Hex4F), creé bucles separados, lo cual es muy engorroso.
¿Alguien conoce una forma de incrementar hexadecimalmente, para poder mantener todo esto dentro de un bucle?
Gracias por su ayuda.
kevin
JMP17
// Loop rows AB-AI; loop columns 63-79
// A = ASCII (41)
// I = ASCII (49)
For( firstChar = 41, firstChar < 42, firstChar++,
For( secondChar = 41, secondChar < 50, secondChar++,
For( number = 63, number < 80, number++,
// Build the list element
firstCharVal = Hex To Char( Char( firstChar ) );
secondCharVal = Hex To Char( Char( secondChar ) );
dataList[listIndex] = firstCharVal || secondCharVal || Char( number );
// Increase the index
listIndex++;
);
);
);
// Loop row AJ; loop columns 63-79
// J = ASCII (4A)
For( firstChar = 41, firstChar < 42, firstChar++,
For( number = 63, number < 80, number++,
// Build the list element
firstCharVal = Hex To Char( Char( firstChar ) );
dataList[listIndex] = firstCharVal || Hex To Char( "4A" ) || Char( number );
// Increase the index
listIndex++;
);
);
Automatización y secuencias de comandosRe: ¿Cómo incremento un bucle usando formato hexadecimal?Es posible que eche un vistazo a la estructura del bucle For Each(). Tiene una estructura de indexación mucho más flexible.
Re: ¿Cómo incremento un bucle usando formato hexadecimal?¡Buena decisión para ForEach!
first = {"A", "B"};
second = {"D", "E", "F"};
number = 9 :: 11;
For Each( {f}, first, //
For Each( {s}, second, //
For Each( {n}, number, //
Write( Eval Insert( "\!n^f^^s^^right(char(/*6 digits of leading zeros*/1e6+n),2)^" ) )
)
)
);
AD09
AD10
AD11
AE09
AE10
AE11
AF09
AF10
AF11
BD09
BD10
BD11
BE09
BE10
BE11
bf09
BF10
BF11
Re: ¿Cómo incremento un bucle usando formato hexadecimal?Craig,
Wow, muchas gracias. Dedicaré más tiempo a comprender la línea "Escribir". ¡Aprecio tu ayuda!
kevin
Re: ¿Cómo incremento un bucle usando formato hexadecimal?txt="hex";first = {"A", "B"};
second = {"D", "E", "F"};
number = 9 :: 11;
For Each( {f}, first, //
For Each( {s}, second, //
For Each( {n}, number, //
txt=txt||( Eval Insert( "\!n^f^^s^^right(char(1e6+n),2)^" ) )
)
)
);
d1=Open( Char To Blob(txt), "text" );¡Gracias expertos!
Re: ¿Cómo incremento un bucle usando formato hexadecimal?@lala : ejemplo interesante. Explicación: la función open generalmente usa un nombre de archivo para su primer parámetro, pero puede tomar un parámetro blob de los datos reales, lo que requiere un segundo parámetro ya que no hay una extensión de archivo. "texto" significa interpretar los datos como un archivo de texto, es decir, un archivo tipo CSV. Este CSV tiene un valor por línea y sin comas.
Re: ¿Cómo incremento un bucle usando formato hexadecimal?¡Gracias Craige!
