Adrian Burkett wrote:There appear to be various tools to convert HTML to Markdown. Can you not use one of those ?
Winston Gutkowski wrote:
Darrin Smith wrote:I didn't spell it out well. After 20+ years of it, starting out with a Tandy Model III and working on VAX, DEC, IBM 360 and everything since, I assure you I understand how things are stored internally.
![]()
I was just looking for a way to stuff a number up to 255 into two consecutive bytes in a stream. I'll just write a little routine for this.
Are you sure you're not thinking of packed decimal? It's more than a decade since I've seen it, but it's the only standardized "hexadecimal" format I can think of. In the above case it would be stored as 0x255C (or 255F for unsigned), which does fit into 2 bytes.
Winston
Jeff Verdegan wrote:
Darrin Smith wrote:
I was just looking for a way to stuff a number up to 255 into two consecutive bytes in a stream. I'll just write a little routine for this.
So..
0x0000 = 0
0x0001 = 1
...
0x00FE = 254
0x00FF = 255
Yes?
You can use a short for that.
On the other hand if you don't care about your Java process interpreting the bytes as the int value 255, and you just care about the bit pattern 0xFF, then simply (byte)0xFF or (byte)255 will do. Your goal still isn't clear though, so it's hard to give concrete advice.
Jeff Verdegan wrote:Vivekk, please do not do the OP's work for him. This site is NotACodeMill(⇐click), and, as it says clearly at the top of the topics page: We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.
Paul Clapham wrote:
Darrin Smith wrote:Well, I need the actual number in hex, not the character representation of it!
Sorry, but you have fundamentally misunderstood how numbers are stored in computers. You can have a byte which contains the decimal value 27. This byte also contains the hexadecimal value 1B and it also contains the octal value 33, because those three things are the same thing. But it doesn't contain any representation of the number. The number is therefore just an abstraction, which you can choose to represent in many ways as a string.
So what was your original requirement which made you think that you needed "a number in hex" as opposed to the character representation in hex?
Winston Gutkowski wrote:
Darrin Smith wrote:I tried doing this too...no help:
...
Pattern.compile(".*=(-?[0-9]+\\.[0-9]+?),([0-9]+),(-?[0-9]+\\.[0-9]+?),(-?[0-9]+\\.[0-9]+?),(-?[0-9]+\\.[0-9]+?),([0-9]*),([0-9]*),([0-9]*)");
...
Again though, using a tool it works. Just not when I run it in a Java application.
That's not quite what I was thinking of. I tried this:
Pattern.compile("GN=-?[0-9]+([.][0-9]+)?(,-?[0-9]+([.][0-9]+)?){7}");
against your test string and it worked just fine.
I suspect you should also make your initial ".*" string ".*?" or "[^=]*".
Winston
Just FYI, my code:
and the output:
Winston Gutkowski wrote:
Darrin Smith wrote:Why does m.matches() return false?
Well, I suspect you don't need the '|' because you don't appear to be matching on it, but I wouldn't have thought it would need escaping inside square brackets.
I also think that "(-?[0-9]+([.][0-9]+)?)" is more correct for a decimal number.
Winston