|
 |
asp_web_howto thread: Obtaining a value from text
Message #1 by "Craig Flannigan" <ckf@k...> on Mon, 1 Jul 2002 16:33:23 +0100
|
|
Hi,
In VB, you can use the VAL() command to display numeric values from a text
string. I know this command is not supported in VBScript, so does anyone
know a way around this?
The text string for example is: "3.5/H"
Any ideas as to how I can replicate this function in VBScript?
Thanks in advance
Craig.
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
Message #2 by kyle.b.willman@u... on Mon, 1 Jul 2002 10:38:16 -0500
|
|
What is it that you are trying to return from the string given in your
example?
Kyle B. Willman
PricewaterhouseCoopers LLP
Office: xxx.xxx.xxxx
Cell: xxx.xxx.xxxx
"Craig Flannigan"
<ckf@k... To: "ASP Web HowTo" <asp_web_howto@p...>
h.com> cc:
07/01/2002 10:33 Subject: [asp_web_howto] Obtaining a value from text
AM
Please respond to
"ASP Web HowTo"
Hi,
In VB, you can use the VAL() command to display numeric values from a text
string. I know this command is not supported in VBScript, so does anyone
know a way around this?
The text string for example is: "3.5/H"
Any ideas as to how I can replicate this function in VBScript?
Thanks in advance
Craig.
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
_________________________________________________________________
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance
upon, this information by persons or entities other than the
intended recipient is prohibited. If you received this in error,
please contact the sender and delete the material from any
computer.
Message #3 by "Craig Flannigan" <ckf@k...> on Tue, 2 Jul 2002 08:29:31 +0100
|
|
I wanted to get the 3.5 from the "3.5/h"
The string could be anything such as "7/a"
So far, my only thought is to use the split command with "/" as the
delimiter.
I just wondered if there was a better method.
Regards
Craig
-----Original Message-----
From: kyle.b.willman@u...
[mailto:kyle.b.willman@u...]
Sent: 01 July 2002 16:38
To: ASP Web HowTo
Subject: [asp_web_howto] Re: Obtaining a value from text
What is it that you are trying to return from the string given in your
example?
Kyle B. Willman
PricewaterhouseCoopers LLP
Office: xxx.xxx.xxxx
Cell: xxx.xxx.xxxx
"Craig Flannigan"
<ckf@k... To: "ASP Web HowTo"
<asp_web_howto@p...>
h.com> cc:
07/01/2002 10:33 Subject: [asp_web_howto]
Obtaining a value from text
AM
Please respond to
"ASP Web HowTo"
Hi,
In VB, you can use the VAL() command to display numeric values from a text
string. I know this command is not supported in VBScript, so does anyone
know a way around this?
The text string for example is: "3.5/H"
Any ideas as to how I can replicate this function in VBScript?
Thanks in advance
Craig.
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
_________________________________________________________________
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance
upon, this information by persons or entities other than the
intended recipient is prohibited. If you received this in error,
please contact the sender and delete the material from any
computer.
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
Message #4 by "TomMallard" <mallard@s...> on Tue, 2 Jul 2002 06:26:03 -0700
|
|
maybe something like...
dim strInput, intLen
intLen = len(strInput)-instrrev(strInput, "/")
mid(strInput, 1, intLen)
Didn't test it...
tom mallard
seattle
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: Tuesday, July 02, 2002 12:30 AM
To: ASP Web HowTo
Subject: [asp_web_howto] Re: Obtaining a value from text
I wanted to get the 3.5 from the "3.5/h"
The string could be anything such as "7/a"
So far, my only thought is to use the split command with "/" as the
delimiter.
I just wondered if there was a better method.
Regards
Craig
-----Original Message-----
From: kyle.b.willman@u...
[mailto:kyle.b.willman@u...]
Sent: 01 July 2002 16:38
To: ASP Web HowTo
Subject: [asp_web_howto] Re: Obtaining a value from text
What is it that you are trying to return from the string given in your
example?
Kyle B. Willman
PricewaterhouseCoopers LLP
Office: xxx.xxx.xxxx
Cell: xxx.xxx.xxxx
"Craig Flannigan"
<ckf@k... To: "ASP Web HowTo"
<asp_web_howto@p...>
h.com> cc:
07/01/2002 10:33 Subject: [asp_web_howto]
Obtaining a value from text
AM
Please respond to
"ASP Web HowTo"
Hi,
In VB, you can use the VAL() command to display numeric values from a text
string. I know this command is not supported in VBScript, so does anyone
know a way around this?
The text string for example is: "3.5/H"
Any ideas as to how I can replicate this function in VBScript?
Thanks in advance
Craig.
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
_________________________________________________________________
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance
upon, this information by persons or entities other than the
intended recipient is prohibited. If you received this in error,
please contact the sender and delete the material from any
computer.
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
Message #5 by "Craig Flannigan" <ckf@k...> on Tue, 2 Jul 2002 14:28:48 +0100
|
|
Thanks Tom. I will try that.
-----Original Message-----
From: TomMallard [mailto:mallard@s...]
Sent: 02 July 2002 14:26
To: ASP Web HowTo
Subject: [asp_web_howto] Re: Obtaining a value from text
maybe something like...
dim strInput, intLen
intLen = len(strInput)-instrrev(strInput, "/")
mid(strInput, 1, intLen)
Didn't test it...
tom mallard
seattle
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: Tuesday, July 02, 2002 12:30 AM
To: ASP Web HowTo
Subject: [asp_web_howto] Re: Obtaining a value from text
I wanted to get the 3.5 from the "3.5/h"
The string could be anything such as "7/a"
So far, my only thought is to use the split command with "/" as the
delimiter.
I just wondered if there was a better method.
Regards
Craig
-----Original Message-----
From: kyle.b.willman@u...
[mailto:kyle.b.willman@u...]
Sent: 01 July 2002 16:38
To: ASP Web HowTo
Subject: [asp_web_howto] Re: Obtaining a value from text
What is it that you are trying to return from the string given in your
example?
Kyle B. Willman
PricewaterhouseCoopers LLP
Office: xxx.xxx.xxxx
Cell: xxx.xxx.xxxx
"Craig Flannigan"
<ckf@k... To: "ASP Web HowTo"
<asp_web_howto@p...>
h.com> cc:
07/01/2002 10:33 Subject: [asp_web_howto]
Obtaining a value from text
AM
Please respond to
"ASP Web HowTo"
Hi,
In VB, you can use the VAL() command to display numeric values from a text
string. I know this command is not supported in VBScript, so does anyone
know a way around this?
The text string for example is: "3.5/H"
Any ideas as to how I can replicate this function in VBScript?
Thanks in advance
Craig.
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
_________________________________________________________________
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance
upon, this information by persons or entities other than the
intended recipient is prohibited. If you received this in error,
please contact the sender and delete the material from any
computer.
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
Message #6 by boryan@s... on Tue, 2 Jul 2002 14:41:05
|
|
May be its better to check each letter?!
resValue=""
for i=0 to Len(txtStr)
curLetter = Mid(txtStr,i,0)
if isNumeric(curLetter) then resValue = resValue & curLetter
next
Hope, it'll help :)
Message #7 by "Larry Woods" <larry@l...> on Tue, 2 Jul 2002 09:13:09 -0700
|
|
Here you go, Craig.
Just copy the following as some xxx.asp file and execute. This
not only shows you how to do it, but the document will allow you
to test various combinations of characters to see if they contain
a number. The algorithm only tests for numbers at the BEGINNING
of the string. characters allowed are 0-9, + and -.
Hope this helps....
Larry Woods
<html>
<head/>
<body>
<form name="frm" action="TestRegExp.asp" method="POST">
<%
if len(request("Input"))<>0 then
Dim oRegExp
set oRegExp=CreateObject("VBScript.RegExp")
oRegExp.Global=False
oRegExp.Pattern="[0-9,\.,\+,-]*"
Dim match
set match=oRegExp.Execute(request("Input"))
if match.count<>0 then
if isnumeric(match(0)) then
response.write match(0) & " is a number"
else
response.write "No number detected in " & request("Input")
end if
end if
end if
%>
<p>Enter a string: <input type=text name=Input /></p>
<input type=submit name=submit value="Send Value"/>
</form>
<body>
</html>
> -----Original Message-----
> From: Craig Flannigan [mailto:ckf@k...]
> Sent: Tuesday, July 02, 2002 6:29 AM
> To: ASP Web HowTo
> Subject: [asp_web_howto] Re: Obtaining a value from text
>
>
> Thanks Tom. I will try that.
>
> -----Original Message-----
> From: TomMallard [mailto:mallard@s...]
> Sent: 02 July 2002 14:26
> To: ASP Web HowTo
> Subject: [asp_web_howto] Re: Obtaining a value from text
>
>
> maybe something like...
>
> dim strInput, intLen
> intLen = len(strInput)-instrrev(strInput, "/")
> mid(strInput, 1, intLen)
>
> Didn't test it...
>
> tom mallard
> seattle
>
> -----Original Message-----
> From: Craig Flannigan [mailto:ckf@k...]
> Sent: Tuesday, July 02, 2002 12:30 AM
> To: ASP Web HowTo
> Subject: [asp_web_howto] Re: Obtaining a value from text
>
>
> I wanted to get the 3.5 from the "3.5/h"
>
> The string could be anything such as "7/a"
>
> So far, my only thought is to use the split command
> with "/" as the
> delimiter.
>
> I just wondered if there was a better method.
>
> Regards
> Craig
>
> -----Original Message-----
> From: kyle.b.willman@u...
> [mailto:kyle.b.willman@u...]
> Sent: 01 July 2002 16:38
> To: ASP Web HowTo
> Subject: [asp_web_howto] Re: Obtaining a value from text
>
>
>
> What is it that you are trying to return from the
> string given in your
> example?
>
> Kyle B. Willman
> PricewaterhouseCoopers LLP
> Office: xxx.xxx.xxxx
> Cell: xxx.xxx.xxxx
>
>
>
> "Craig Flannigan"
> <ckf@k... To:
> "ASP Web HowTo"
> <asp_web_howto@p...>
> h.com> cc:
> 07/01/2002 10:33
> Subject: [asp_web_howto]
> Obtaining a value from text
> AM
>
> Please respond to
> "ASP Web HowTo"
>
>
>
>
>
>
>
> Hi,
>
> In VB, you can use the VAL() command to display
> numeric values from a text
> string. I know this command is not supported in
> VBScript, so does anyone
> know a way around this?
>
> The text string for example is: "3.5/H"
>
> Any ideas as to how I can replicate this function in VBScript?
>
>
> Thanks in advance
> Craig.
>
>
>
>
> _______________________________________________________
> ______________
> This message has been checked for all known viruses by
> Star Internet
> delivered through the MessageLabs Virus Scanning
> Service on behalf of
> Kingfield Heath Ltd. For further information visit
> http://www.star.net.uk/stats.asp
>
>
> ---
>
> Improve your web design skills with these new books
> from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=n
> osim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=n
> osim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=n
> osim/theprogramme
> r-20
>
>
>
>
> _______________________________________________________
> __________
> The information transmitted is intended only
> for the person or
> entity to which it is addressed and may
> contain confidential
> and/or privileged material. Any review,
> retransmission,
> dissemination or other use of, or taking of
> any action in reliance
> upon, this information by persons or entities
> other than the
> intended recipient is prohibited. If you
> received this in error,
> please contact the sender and delete the
> material from any
> computer.
>
>
>
> ---
>
> Improve your web design skills with these new books
> from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=n
> osim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=n
> osim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=n
> osim/theprogramme
> r-20
>
> _______________________________________________________
> ______________
> This message has been checked for all known viruses by
> Star Internet
> delivered through the MessageLabs Virus Scanning
> Service on behalf of
> Kingfield Heath Ltd. For further information visit
> http://www.star.net.uk/stats.asp
>
>
> _______________________________________________________
> ______________
> This message has been checked for all known viruses by
> Star Internet
> delivered through the MessageLabs Virus Scanning
> Service on behalf of
> Kingfield Heath Ltd. For further information visit
> http://www.star.net.uk/stats.asp
>
>
> ---
>
> Improve your web design skills with these new books
> from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=n
> osim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=n
osim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/thepr
ogramme
r-20
---
Improve your web design skills with these new books from
Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/thepr
ogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/thepr
ogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/thepr
ogramme
r-20
_________________________________________________________________
____
This message has been checked for all known viruses by Star
Internet
delivered through the MessageLabs Virus Scanning Service on
behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_________________________________________________________________
____
This message has been checked for all known viruses by Star
Internet
delivered through the MessageLabs Virus Scanning Service on
behalf of Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
---
Improve your web design skills with these new books from
Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/thepr
ogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/thepr
ogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/thepr
ogramme
r-20
|
|
 |