How to convert decimal to hex?Hi all,
Please tell me how to convert a decimal number like 255 into its
corresponding hex value.
For example I want a result of "ff" for a decimal of 255.
I've tried playing with the functions ord, hex, pack, ... but with no
result.
Thank you.
Teddy's Center: http://teddy.fcc.ro/
Mail: orasnita@home.ro
$HEX = sprintf "%1x", $DEC;
for more, perldoc -f sprintf
Rgds,
Connie
----- Original Message -----
From: "Octavian Rasnita" <orasnita@home.ro>
To: <beginners-cgi@perl.org>
Sent: Friday, August 09, 2002 3:11 ...
help,how to convert hex to decimal?
The following converts from any base to decimal:
function ulong uf_BaseTo10(integer ai_base, string as_number)
integer i, li_max
unsignedlong ll_return, ll_num
string ls_char
as_number = Upper(as_number)
li_max = Len(as_number)
for i = li_max to 1 step -1
ls_char = Mid(as_number,i,1)
if IsNumber(ls_char) then
ll_num = integer(ls_char)
else
ll_num = Asc(ls_char) - 55
end if
ll_num *= ai_base^(li_max-i)
ll_return += ll_num
next
return ll_return
HTH
Simon
192.168.0.2 <tech@chinachemfibre.com> wrote in message...
Converting an image file from binary to hex decimal
I need an asp.net code that converts an image file from binary to hexadecimal and vise versa. that is a requirement by the client
thanks
Here is some code.Thanks------------------------------------------------------------This posting is provided "AS IS" with no warranties, and confers no rights. ...
Any one have a PB function to convert hex to decimal?Got some coworkers here trying to decipher some ugly file
over here. All help appreciated - thanks!
Nope...don't have one here. Why would you need anything
like that?
> Got some coworkers here trying to decipher some ugly file
> over here. All help appreciated - thanks!
> Got some coworkers here trying to decipher some ugly file
> over here. All help appreciated - thanks!
This extension of PFC's numerical service has it:
http://www.pfcguide.com/extensions/ext_0005.asp
...
Convert Decimal To 2-Bytes Hex ValueHi all,
I want to convert with PB7 a decimal value (ie 1487) to a hex 2-bytes
number.
Simple question, but does anyone knows how to make it work
Thank you in advance
Alex /Open Support
The easiest way I can think of is to write a small DLL that exports a
function like the following:
void IntToHex( int input, char * output )
{
sprint( output, "%X", input );
}
Then, declare a local external function in PB as follows:
SUBROUTINE IntToHex( long input, REF string output ) LIBRARY
"mysimpledll.dll"
Sample PowerScript:
String ls_hex
l...
how to convert hex string to hex bytes?Hi I've been trying and haven't found a solution for this yet and hopefully some of you can give me a direction to solve this problem.
I have a string in hex representation i.e, 64 chars 'AB23FFFE.....'
How can I convert it to 32 chars String where each byte is $AB $23 $FF $FE .... ?
Even if I do it manually, can I store the hex(non ASCII) to String?
Thanks for looking!!
edwin wrote:
> I have a string in hex representation i.e, 64 chars 'AB23FFFE.....'
> How can I convert it to 32 chars String where each byte is $AB $23 $FF
> $FE .... ?
Th...
how to convert value with decimal point into value with decimal comma
Hello,
I like to know how I can change (for example) the value 55.55 into 55,55. (The system in my country is using comma's instead of points)
I'm starting with a string with the value "55.55"
Then I will convert it to a double 55,55
Do I need the the system.Globalization namespace or is there just a simple solution?
Hi,If you are just going to use this format for display then it would be easy to do this:double dTemp;dTemp = 55.55;Response.Write(dTemp.ToString().Replace(".",","));H...
Cannot convert to decimal
I have a money field in SQL that when i try and get the sum of it i cannot convert it to decimal. This was working now its not, and nothing was changed.Any reason for the error? DECLARE @TEST decimal(10,2)SET @Test = (SELECT SUM(INV_Net) FROM abc.dbo.iSplit_Details WHERE LoanID='0000010604')Print @TestRETURNS: 160471.24----------------------------------------------------------------------------------------------------------------------------------------------------------------------------Specified cast is not valid. Description:
An unhandled exception occurred durin...
convert to Decimal
Hi,
i get the error "Unable to cast object of type 'System.Decimal' to type 'System.String'." with my following coding: the Cap_Authorized data type is Decimal, how do i convert it ? private void LoadDBCpt(SqlConnection myConn)
{SqlCommand SelectCmdCpt = new SqlCommand("SELECT isnull(Cap_Authorized,'-') as Cap_Authorized," +
"isnull(Cap_PaidUp,'-') as Cap_PaidUp," +"isnull(Cap_Working,'-') as Cap_Working FROM tbl_Companies" +
" WHERE Company_ID = '" + Request.QueryString["Company_I...
Convert to decimalHi,
ASA 9.0.2.3044
select convert(decimal(5,2),0) returns 0.00
select convert(decimal(5,2),1.3) returns 1.3
select convert(decimal(5,2),0.3) returns .3
How can tell ASA to return 0.3 in case
select convert(decimal(5,2),0.3) or when
select convert(decimal(5,2),A/B) where
A/B < 1
TIA
Vesselin
dbisqc and PHP module return .3
dbisqlg returns 0.3
"Veselin Ivanov" <vs@sonita.com> wrote in message
news:428c3e76@forums-1-dub...
> Hi,
> ASA 9.0.2.3044
>
> select convert(decimal(5,2),0) returns 0.00
> select convert(decimal(5,2),1.3) ret...
decimal to hex
Is there a way to create a SP or UDF that converts a decimal number to hexidecimal notation?
run this in Query Analyzer
SELECT CAST(255 as varbinary)
SELECT CAST(10 as varbinary)
SELECT CAST(26 as varbinary)
cool eh?RTFM - straight talk for web developers. Unmoderated, uncensored, occasionally unreadableJason Brown - MVP, IIS
very nice, thanks!
Can I stick something like this in a Formula field?
For example, say I have table Orders with columns OrderID (of type int) and OrderNumber.
I tried putting in the Formula (under "design table")
SELECT CAST(([Orde...
converting the values of a text box to decimal but with only two decimal spaces
I have a number like this ?
45,9098944 want to get only 45,91
what will be the best way to acomplish this,
so far I been doing this,
decimal AnnualAmount = Math.Round(Convert.ToDecimal(txtAnnualAmount.Text), 2);is this correct or is there a better way
Do you need it to be output somewhere, or you need to cut the amount of numbers after the decimal point, and store it in a variable, like you suggested?
So far, seems absolutely correct to me.
Andrey
I need to displayed back to the page in a label,&nb...
Convert from hex echo
http%3A%2F%2Fwww.merifiles.com%2Fuploads%2Fmf_aR_Ek_Ajnabi_-_01_-_Ek_Ajnabi_%28Mama_Told_Me%29%28128Kbps%29.mp3|
perl -e '
$_=<>;s/%(..)/\\x$1/xg;
print "$_";
'
This outputs
http\x3A\x2F\x2Fwww.merifiles.com\x2Fuploads\x2Fmf_aR_Ek_Ajnabi_-_01_-_Ek_Ajnabi_\x28Mama_Told_Me\x29\x28128Kbps\x29.mp3
Why does print not print the hex character in question?
But,
-bash-2.05b$ perl -e '
> print
"http\x3A\x2F\x2Fwww.merifiles.com\x2Fuploads\x2Fmf_aR_Ek_Ajnabi_-_01_-_Ek_Ajnabi_\x28Mama_Told_Me\x29\x28128Kbps\x29.mp3"
> '
http:/...
Converting to HexIs there a simple way, like a one liner perhaps, that will give me the
octal/hex value of a character? I need to look certain characters up,
so I would like to be able to give it something like an 'a' or even
"\n" and have it answer 141 or 012 (assuming UNIX). Thanks for your
time.
James
check out sprintf() and ord()
quickly for you example:
## hex
perl -e 'printf("%x", ord("\n"))'
## oct
perl -e 'printf("%o", ord("\n"))'
> -----Original Message-----
> From: James Edward Gray II [m...