Solved

val function in asp

Posted on 2003-12-12
4
2,213 Views
Last Modified: 2007-12-19
How do I use "VAL" function is asp?
this code here works in vb but not on asp
Please Help.

Mid(Temp, I, 1) = Chr(Val("&H" & Mid(HexStr, I * 2 - 1, 2)))

Thank you.
0
Comment
Question by:MAXMASTER
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 42

Expert Comment

by:frodoman
ID: 9929783
You don't need to use it:

Mid(Temp, I, 1) = Chr("&H" & Mid(HexStr, I * 2 - 1, 2))

This works fine w/out the Val function.
0
 
LVL 1

Author Comment

by:MAXMASTER
ID: 9930487
thanks for your answer so maybe you could help me with this error im
getting after removing the val

error in this line

Mid(Temp, I, 1) = Chr("&H" & Mid(HexStr, I * 2 - 1, 2))

ERROR!!!
Microsoft VBScript runtime error '800a000d'

Type mismatch: 'Mid'

0
 
LVL 42

Accepted Solution

by:
frodoman earned 125 total points
ID: 9930669
When I said it works fine, I was looking at the right side of the equation (which is fine).  

You can't use Mid() as an assignment in asp.  You'll have to append inside a loop or something similar instead.

For example:

HexStr="414243"
Temp = ""
I = 1
Do While I <= Len(HexStr)/2
   Temp = Temp & Chr("&H" & Mid(HexStr, I * 2 - 1, 2))
   I = I + 2
Loop
Response.Write(Temp)  <--- Produces "ABC"
0
 
LVL 1

Author Comment

by:MAXMASTER
ID: 9931315
Ok I will give you the points but I cant use that code anymore because it somewhat give me a wrong value

anyway thank you for your help

0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question