Converting Hex to integer in VBscript

Hello, Can someone help me with the above question? i don't know if it requires more detail, but i need to convert 4 Hex chars into integers. Also, the conversion must start 6 chars after the beginning of the mumber.

thanks,

mb
mikeandbeeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RBertoraCommented:
function cint;

<% response.write(cint(&H10)) %>
will produce

16

Rob ;-)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mikeandbeeAuthor Commented:
thanks...

i have some more details with regards to what i want to do.

I have eight HEX chars

e.g

c8a00a10

i need to convert this into a number like this:

141.134.12.45 (ie like an ip address)

trying to convert 8 Hex chars at a time leads to an overflow error.

whats more i need to remove the first 10 chars in front of the HEX chars. A typical string like this would be:

/x29944800c8a00a10

can you help?

thanks,

mb
0
RBertoraCommented:
Here it is:

<%

  Newpart = mid("/x29944800c8a00a10",10,8)


  Response.Write(NewPart)
  Response.Write("<BR>")  
  OnePart = mid(newpart,1,2)
  OneConv = "&H"&OnePart

  TwoPart = mid(newpart,3,2)
  TwoConv = "&H"&TwoPart

  ThreePart = mid(newpart,5,2)
  ThreeConv = "&H"&ThreePart

  FourPart = mid(newpart,7,2)
  FourConv = "&H"&FourPart


  Response.Write("<BR>")
  Response.Write(cint(OneConv))
  Response.Write(".")
  Response.Write(cint(TwoConv))
  Response.Write(".")
  Response.Write(cint(ThreeConv))
  Response.Write(".")
  Response.Write(cint(FourConv))
%>

Rob ;-)
0
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

mikeandbeeAuthor Commented:
thanks. can you just tell me how i can take a string with say "/x29944800c8a00a10" entered into a text box, and then submit it to the Hex convertor?
I have tried simply using request.form("HexToConvert") and then substituting that with
strConvert = request.form("HexToConvert")
Newpart = mid strConvert ",10,8),
but i can't get this to work. how can i do this?
thank you very much for your help.


 
0
RBertoraCommented:
Your idea seems fine, just this line needs to be diff:

Newpart = mid strConvert ",10,8),

this line should read:

Newpart = mid (strConvert,10,8)

Rob;-)

0
mikeandbeeAuthor Commented:
thanks very much
0
RBertoraCommented:
thanks
and good luck
Rob;-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.