How to divide hex to hex

Recommended Posts

For examlpe:

I have string str = ftq

I need divide this string it on 1Ah (1A in hex). As result i need hex string.

So how 667471/1A to do??

667471 is _StringToHex('ftq')

ps:sorry for my english(

Share on other sites
whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...

Share on other sites

You asked for it, you got it!

Step by step:

```Local \$str = 'ftq'
Local \$bin = StringToBinary(\$str, 1)        ;; 1 = assume ANSI string
ConsoleWrite('Your string:  ' & \$str & @LF)
ConsoleWrite('Its binary representation:    ' & \$bin & @LF)
;; we need to reverse the bytes since the PC processor is Little Endian (Google!)
ConsoleWrite('The equivalent decimal value: ' & Int(StringToBinary(_StringReverse(\$str), 1)) & @LF)
ConsoleWrite('Your result:  ' & Int(StringToBinary(_StringReverse(\$str), 1)) / 0x1A & @LF)```

Edit: <wrong click!> It's still unclear how you want the result converted to hex. Most of the times, the result will be a floating-point number, whose representation is a IEEE format, certainly not what you want to see, hex or not.

What precisely do you want to achieve? Dividing ASCII characters representation (and under _which_ encoding?) by a hex value is like a train divided by your mouse.

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share on other sites

sorry, have forgotten to write type of result ((

I need result in hex representaion.

If this

\$pass = _StringToHex(\$text)

\$pass = Dec(\$pass)

\$pass = Hex(\$pass / 26) (26 = 1Ah)

result as floating, but i need in hex

thx!

Share on other sites

sorry, have forgotten to write type of result ((

I need result in hex representaion.

If this

\$pass = _StringToHex(\$text)

\$pass = Dec(\$pass)

\$pass = Hex(\$pass / 26) (26 = 1Ah)

result as floating, but i need in hex

The only little problem that you don't seem to realize is that the result is not an integer, in most cases. Use Round or Ceiling or Floor if you want an approximate integral [meaningless] result.

Anyway, the very idea of dividing any representation of some encoding of a string by a fixed value smells terribly wrong.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Create an account

Register a new account