Page 1 of 1
operator ^^ como puedo solucionar?
Posted: Thu Jan 30, 2025 8:28 pm
by MGA
Al compilar me da error con el operador ^^ ¿como puedo solucionar la siguiente función?
function ...
cHex := ""
cChar := ""
For Each cChar IN cResposta
if HB_EnumIndex( cChar ) < Len( cResposta )
if HB_EnumIndex( cChar ) == nStartEvaluate
cHex := cChar
endif
cHex := cHex ^^ cResposta[ HB_EnumIndex( cChar ) + 1 ]
endif
next
return cHex
Re: operator ^^ como puedo solucionar?
Posted: Thu Jan 30, 2025 9:29 pm
by leandro
Ya intentaste con el doble asterisco? **
Re: operator ^^ como puedo solucionar?
Posted: Thu Jan 30, 2025 9:59 pm
by Antonio Linares
Tal vez quiere hacer una operación Xor ?
Re: operator ^^ como puedo solucionar?
Posted: Fri Jan 31, 2025 1:41 pm
by MGA
Sr Antonio, não entendo muito bem a função, mas acredito que sim.
Seria referente esta linha de código:
cHex := cHex ^^ cResposta[ HB_EnumIndex( cChar ) + 1 ]
static function BitXorString( cResposta, nStartEvaluate )
Local cHex, cChar
Default nStartEvaluate := 1
cHex := ""
cChar := ""
For Each cChar IN cResposta
if HB_EnumIndex( cChar ) < Len( cResposta )
if HB_EnumIndex( cChar ) == nStartEvaluate
cHex := cChar
endif
cHex := cHex ^^ cResposta[ HB_EnumIndex( cChar ) + 1 ]
endif
next
return cHex
Re: operator ^^ como puedo solucionar?
Posted: Fri Jan 31, 2025 5:16 pm
by Antonio Linares
Entonces puedes usar la función NumXor() de Harbour:
cHex := Chr( NumXor( Asc( cHex ), Asc( cResposta[ HB_EnumIndex( cChar ) + 1 ] ) ) )
Re: operator ^^ como puedo solucionar?
Posted: Fri Jan 31, 2025 5:35 pm
by MGA
Sr. Antonio,
CHAR = chr
ok?
Re: operator ^^ como puedo solucionar?
Posted: Fri Jan 31, 2025 5:38 pm
by Antonio Linares
MGA wrote: Fri Jan 31, 2025 5:35 pm
Sr. Antonio,
CHAR = chr
ok?
Yes!
