Discussions related to Visual Prolog
User avatar
drspro2
VIP Member
Posts: 97
Joined: 28 Apr 2006 12:03

convert vpi color to string

Unread post by drspro2 »

when i Insert a vip color through the insert-menu in the editor i get for example this color:

0xB3B3FF

after that i would like to have this color to a string like "0xB3B3FF",

but when i use: toString( 0xB3B3FF ) the result of that is "11777023"

but i would like to have "0xB3B3FF" is there a way to realize that?


thankyou
User avatar
Thomas Linder Puls
VIP Member
Posts: 1401
Joined: 28 Feb 2000 0:01

Re: convert vpi color to string

Unread post by Thomas Linder Puls »

The very short answer:

Code: Select all

        ColorHex = string::format("0x%06x", 0xB3B3FF),
You can find more on format strings (which are also used by outputStream::writef) here: Language_Reference/Domains#Format_Strings.
Regards Thomas Linder Puls
PDC
User avatar
drspro2
VIP Member
Posts: 97
Joined: 28 Apr 2006 12:03

Re: convert vpi color to string

Unread post by drspro2 »

thankyou , it works
Post Reply