[Deleted]
Re: Convert $23 to literal string value?
This?
Code: Select all
Macro hexLit(hx) : Str(2000+Val(Hex(hx))) : EndMacro
Debug hexLit($0) ; Want "2000"
Debug hexLit($23) ; Want "2023"
Debug hexLit($99) ; Want "2099"
Re: Convert $23 to literal string value?
Don't worry about it.
Last edited by BarryG on Sun Dec 24, 2023 1:10 pm, edited 2 times in total.
Re: [Solved] Convert $23 to literal string value?
Does this help?
Edit... drat! to slow. haha
Code: Select all
Debug "20"+ LTrim("$23","$") ; Want "2023"- It was too lonely at the top.
System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
Re: [Solved] Convert $23 to literal string value?
Don't worry about it.
Last edited by BarryG on Sun Dec 24, 2023 1:10 pm, edited 1 time in total.
Re: [Solved] Convert $23 to literal string value?
@BarryG
Do hey mean BCD (binary-coded decimal)
Then your for next loop ist wrong
Do hey mean BCD (binary-coded decimal)
Then your for next loop ist wrong
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Convert $23 to literal string value?
Don't worry about it.
Last edited by BarryG on Sun Dec 24, 2023 1:10 pm, edited 1 time in total.
- NicTheQuick
- Addict

- Posts: 1527
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: Convert hex of $23 to literal string of "23"
If you want your for loop to show you the decimal numbers from 0 to 99, why do you iterate from 0 to 153?
Here's your solution:
Here's your solution:
Code: Select all
For h = 0 To 99
Debug Str(h)
NextThe english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
- NicTheQuick
- Addict

- Posts: 1527
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: Convert hex of $23 to literal string of "23"
And if you want it to show the hexa decimal numbers from $0 to $99, do it like this:
Code: Select all
For h = $0 To $99
Debug Hex(h)
NextThe english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Re: Convert hex of $23 to literal string of "23"
Don't worry about it.
Last edited by BarryG on Sun Dec 24, 2023 1:09 pm, edited 3 times in total.
- NicTheQuick
- Addict

- Posts: 1527
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: Convert hex of $23 to literal string of "23"
A hex value and a base-16 number are the same thing.
Just use `Hex()` as I did in my second example:
Just use `Hex()` as I did in my second example:
Code: Select all
Debug Hex($23)The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
- NicTheQuick
- Addict

- Posts: 1527
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: Convert hex of $23 to literal string of "23"
And if you want to convert it literally to a decimal number, do this:
But remember that there are hexadecimal values with letters in it. In this case it will fail of course.
Code: Select all
For h = $0 To $99
Debug Val(Hex(h))
NextThe english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Re: Convert hex of $23 to literal string of "23"
Don't worry about it.
Last edited by BarryG on Sun Dec 24, 2023 1:09 pm, edited 1 time in total.
Re: Convert hex of $23 to literal string of "23"
Don't worry about it.
Last edited by BarryG on Sun Dec 24, 2023 1:09 pm, edited 1 time in total.
- NicTheQuick
- Addict

- Posts: 1527
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: Convert hex of $23 to literal string of "23"
That's what I just told you. What are you expecting?
Your request is very silly. What do you want to achieve here?
You can not literally convert the hexa-decimal number 1C to decimal. `Val()` will just convert it to 1.
If you iterate from $0 to $99, you basically iterate from 0 to 153. That means that there are 153-99=54 values that can not be converted to decimal. Just think about it. At this point I get the feeling you just wanna troll me.
Your request is very silly. What do you want to achieve here?
You can not literally convert the hexa-decimal number 1C to decimal. `Val()` will just convert it to 1.
If you iterate from $0 to $99, you basically iterate from 0 to 153. That means that there are 153-99=54 values that can not be converted to decimal. Just think about it. At this point I get the feeling you just wanna troll me.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.

