String Formating
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by pusztry.
Is there an equivalent to VBs "USING" Command? I need to take the 24 bit number the colorrequester returns and format it into a hex RGB number. The problem I run into is that it doesn't keep the zeros at the end in.
Ex. should be
00FF00
But it is
00FF
Thanks,
Ryan
Ryan
WinXP, PIII 800 MHz, 512MB RAM, SB Live 5.1, NVidia TNT 2 Ultra
Is there an equivalent to VBs "USING" Command? I need to take the 24 bit number the colorrequester returns and format it into a hex RGB number. The problem I run into is that it doesn't keep the zeros at the end in.
Ex. should be
00FF00
But it is
00FF
Thanks,
Ryan
Ryan
WinXP, PIII 800 MHz, 512MB RAM, SB Live 5.1, NVidia TNT 2 Ultra
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by freak.
No, there is no such command in PB.
Are you sure, it cuts the 0's at the end? Usually those in front are cut,
cutting those at the End changes the Value.
Anyway, you can also get it like this:
That's it...
Timo
--
If it stinks, it's chemistry. If it moves, it's biology.
If it does not work, It's computer science.
No, there is no such command in PB.
Are you sure, it cuts the 0's at the end? Usually those in front are cut,
cutting those at the End changes the Value.
Anyway, you can also get it like this:
Code: Select all
var.l = $FF00
string.s = Right("000000"+Hex(var), 6)
Timo
--
If it stinks, it's chemistry. If it moves, it's biology.
If it does not work, It's computer science.
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
> there is no such command in PB.
I've suggested it to Fred, so fingers crossed.
BTW, Mr Skunk used to have this command in one of his libraries, but it doesn't
work with v3.20 anymore. I wish he'd come back out of the woodwork!
PB - Registered PureBasic Coder
> there is no such command in PB.
I've suggested it to Fred, so fingers crossed.
BTW, Mr Skunk used to have this command in one of his libraries, but it doesn't
work with v3.20 anymore. I wish he'd come back out of the woodwork!
PB - Registered PureBasic Coder
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Danilo.
> BTW, Mr Skunk used to have this command in one of his libraries,
> but it doesn't work with v3.20 anymore.
> I wish he'd come back out of the woodwork!
Somebody could disassemble the old library
and change it to work with v3.20+
(or just rewrite it)
Just say in which library it is...
(still on Paul´s site?)
cya,
...Danilo
(registered PureBasic user)
> BTW, Mr Skunk used to have this command in one of his libraries,
> but it doesn't work with v3.20 anymore.
> I wish he'd come back out of the woodwork!
Somebody could disassemble the old library
and change it to work with v3.20+
(or just rewrite it)
Just say in which library it is...
(still on Paul´s site?)
cya,
...Danilo
(registered PureBasic user)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Danilo.
> It was his "String2" library, the one that had his Space()
> command before Fred rewrote it as a native command.
OK, thanks PB !!
Using() and StripAll() are very useful, so
i converted Mr.Skunk´s old library for PB 3.20.
I disassembled/rewrote it to the new Library format,
so only the used command is included in the final EXE.
So you see that disassembling is very useful sometimes...
Some time ago, Paul deleted some Libraries that didnt
work anymore from his site.
If you can tell me which libraries didnt work anymore,
i can try to convert that too and include it in
the new library.
This works fine so far:
cya,
...Danilo
(registered PureBasic user)
> It was his "String2" library, the one that had his Space()
> command before Fred rewrote it as a native command.
OK, thanks PB !!
Using() and StripAll() are very useful, so
i converted Mr.Skunk´s old library for PB 3.20.
I disassembled/rewrote it to the new Library format,
so only the used command is included in the final EXE.
So you see that disassembling is very useful sometimes...
Some time ago, Paul deleted some Libraries that didnt
work anymore from his site.
If you can tell me which libraries didnt work anymore,
i can try to convert that too and include it in
the new library.
This works fine so far:
Code: Select all
RETN.s = Chr(13)
A$ = Using("# ### ###",1234567) ; = "1 234 567"
B$ = Using("000000",12)) ; = "000012"
C$ = Using("000 ### $",12325) ; = "012 325 $"
D$ = Using("###-",12) ; = " 12 "
E$ = Using("0##+",-12) ; = "012-"
F$ = Using("I'm ## Years Old",31) ; = "I'm 31 Years Old"
G$ = StripAll(" What a Beautifull library :wink: "," ") ; = "WhataBeautifulllibrary;-)"
H$ = StripAll(" Welcome to my Home ","om") ; = " Welce to my He "
MessageRequester("INFO", A$+RETN+B$+RETN+C$+RETN+D$+RETN+E$+RETN+F$+RETN+RETN+G$+RETN+H$ ,0)...Danilo
(registered PureBasic user)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Paul.
Hi Danilo,
The libraries I removed from the menu were:
iniFile
System2
Registry
TimeandDate
DLL
You can still get at them if you use a direct URL...
http://www.reelmediaproductions.com/pb/lib
Hi Danilo,
The libraries I removed from the menu were:
iniFile
System2
Registry
TimeandDate
DLL
You can still get at them if you use a direct URL...
http://www.reelmediaproductions.com/pb/lib
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Pupil.
It's not totally necessary to convert the StripAll() command as you can get the same results with the ReplaceString() command...Using() and StripAll() are very useful, so
i converted Mr.Skunk´s old library for PB 3.20.
Code: Select all
a$ = ReplaceString(" What a Beautifull library :wink: ", " ", "")
b$ = ReplaceString(" Welcome to my Home ", "om", "")
Debug a$
Debug b$
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Danilo.
Thanks Paul !!
I looked now at Mr.Skunk´s Libraries:
Number, Registry, String2, System1, System2, Taskbar, Time&Date
I think i should convert all this Libs
to the new library format.
The other 3 Libraries DLL, GUI, iNiFile
are IMO not needed.
DLL and Preferences support is available in PB now.
Maybe i´ll look at Wayne1´s libraries too.
Looks like Wayne1 is also gone for a long time now..
The Clipboard lib isnt needed anymore (available in PB),
but StringLibraryEx, CharacterTest, ProcessTime and FileEx
are OK.
HtmlHelp documentation ?? Hmmm...
Release is when finished.
(remember me )
cya,
...Danilo
(registered PureBasic user)
Thanks Paul !!
I looked now at Mr.Skunk´s Libraries:
Number, Registry, String2, System1, System2, Taskbar, Time&Date
I think i should convert all this Libs
to the new library format.
The other 3 Libraries DLL, GUI, iNiFile
are IMO not needed.
DLL and Preferences support is available in PB now.
Maybe i´ll look at Wayne1´s libraries too.
Looks like Wayne1 is also gone for a long time now..
The Clipboard lib isnt needed anymore (available in PB),
but StringLibraryEx, CharacterTest, ProcessTime and FileEx
are OK.
HtmlHelp documentation ?? Hmmm...
Release is when finished.
(remember me )
cya,
...Danilo
(registered PureBasic user)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Danilo.
Not much time atm, so here is what i have so far:
Mr.Skunk´s old libraries System2 and String2
converted to PB 3.20 and done in the new .lib format:
http://home.t-online.de/home/ExpressTrack/SkunkLIB.zip
Includes 2 String commands and Date/Time commands.
Read the original DOCs from Mr.Skunk (also included).
Test included:
Attention, 2 changed command names:
DayWeek() is now DayOfWeek() !!
MSecond() is now MilliSecond() !!
cya,
...Danilo
(registered PureBasic user)
Edited by - Danilo on 13 August 2002 09:56:21
Not much time atm, so here is what i have so far:
Mr.Skunk´s old libraries System2 and String2
converted to PB 3.20 and done in the new .lib format:
http://home.t-online.de/home/ExpressTrack/SkunkLIB.zip
Includes 2 String commands and Date/Time commands.
Read the original DOCs from Mr.Skunk (also included).
Test included:
Code: Select all
RETN.s = Chr(13)
A$ = Using("# ### ###",1234567) ; = "1 234 567"
B$ = Using("000000",12)) ; = "000012"
C$ = Using("000 ### $",12325) ; = "012 325 $"
D$ = Using("###-",12) ; = " 12 "
E$ = Using("0##+",-12) ; = "012-"
F$ = Using("I'm ## Years Old",31) ; = "I'm 31 Years Old"
G$ = StripAll(" What a Beautifull library :wink: "," ") ; = "WhataBeautifulllibrary;-)"
H$ = StripAll(" Welcome to my Home ","om") ; = " Welce to my He "
MessageRequester("INFO", A$+RETN+B$+RETN+C$+RETN+D$+RETN+E$+RETN+F$+RETN+RETN+G$+RETN+H$ ,0)
GetTime()
a = Year() : b = Month() : c = DayOfWeek() : d = Day()
e = Hour() : f = Minute() : g = Second() : h = MilliSecond()
MessageRequester("TIME", "Date: "+Str(d)+"."+Str(b)+"."+Str(a) +RETN+ "Time: "+Str(e)+":"+Str(f)+":"+Str(g)+":"+Str(h)+RETN+"Day of Week: "+Str(c) ,0)DayWeek() is now DayOfWeek() !!
MSecond() is now MilliSecond() !!
cya,
...Danilo
(registered PureBasic user)
Edited by - Danilo on 13 August 2002 09:56:21
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ebs.
Danilo,
Do you have any idea why this problem happens?
Value.s = Using("##",13) + ":" + Using("00",51)
Val1.s = Using("##",13)
Val2.s = Using("00",51)
Val3.s = Val1 + ":" + Val2
Debug Value.s ' prints "1" - wrong
Debug Val1 + ":" + Val2 ' prints "13:51" - correct
Debug Val3 ' prints "13:51" - correct
I would expect all three Debug lines to display the same thing ("13:51"), but the first one doesn't. If "Using()" returns a string, why can't it be used as in the first line above?
Regards,
Eric
Danilo,
Do you have any idea why this problem happens?
Value.s = Using("##",13) + ":" + Using("00",51)
Val1.s = Using("##",13)
Val2.s = Using("00",51)
Val3.s = Val1 + ":" + Val2
Debug Value.s ' prints "1" - wrong
Debug Val1 + ":" + Val2 ' prints "13:51" - correct
Debug Val3 ' prints "13:51" - correct
I would expect all three Debug lines to display the same thing ("13:51"), but the first one doesn't. If "Using()" returns a string, why can't it be used as in the first line above?
Regards,
Eric
Not much time atm, so here is what i have so far:
Mr.Skunk´s old libraries System2 and String2
converted to PB 3.20 and done in the new .lib format:
http://home.t-online.de/home/ExpressTrack/MrSkunk.zip
Includes 2 String commands and Date/Time commands.
Read the original DOCs from Mr.Skunk (also included).
cya,
...Danilo
(registered PureBasic user)
Edited by - Danilo on 10 August 2002 16:34:03