Author |
Topic |
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2005-06-22 : 10:24:14
|
hello,am using an XML feature to web crawl on my provider's site to get a response of an sms message sent.Am using [CODE]ehioze = left(sResult,3)[/CODE]However, i only want the results of ehioze only if its numeric characters. and if there are any alphabets, it shoudl exlude it.How woudl this be done ?Afrika |
|
dsdeming
479 Posts |
Posted - 2005-06-22 : 10:28:03
|
You could use LIKE '[0-9][0-9][0-9]'Dennis |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-06-22 : 10:29:20
|
Can you use isnumeric function? Something likeIf isnumeric(left(sResult,3)) thenehioze = left(sResult,3)MadhivananFailing to plan is Planning to fail |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2005-06-22 : 10:31:24
|
quote: Originally posted by dsdemingLIKE '[0-9][0-9][0-9]'
sorry sir this is VB script. Not SQL Server:-) |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2005-06-22 : 10:40:49
|
quote: Can you use isnumeric function? Something likeIf isnumeric(left(sResult,3)) thenehioze = left(sResult,3)Madhivanan
Thanks Madhivanan, This is good. The only thing wrong here is that i dont just want to check if the first 3 are numeric. I want to be able to read the first 3 numeric characters and exclude any alphabets. And just iterate only numeric characters.Any advice ? |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-06-22 : 10:49:18
|
I am not good in VBScript Try thisDim s,i,ehioze ehioze =''for i=0 to len(sResult)-1 if isnumeric(mid(sResult,i,1)) then ehioze =ehioze & mid(sResult,i,1) end if if len(ehioze)>=3 then exit fornext i MadhivananFailing to plan is Planning to fail |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2005-06-22 : 10:57:57
|
Did i hear you say you are not good in VB script ? |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-06-22 : 11:00:04
|
WellDid that code work? MadhivananFailing to plan is Planning to fail |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2005-06-22 : 11:14:37
|
Just a min. Its actually a long code am working with.Would give you a feedback very soon:-) |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2005-06-22 : 12:05:29
|
NOPEquote: Expected end of statement /jim.asp, line 32 next i-----^
|
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2005-06-22 : 12:06:42
|
By the way, there were two errors you mixed up with SQL1. The single quotation marks, which is double in ASP2. The exit for ? does not work with ASPAm modifying your code |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2005-06-22 : 14:11:16
|
... and a for loop does not require the next varable. It is:for i = 0 to blah..blahblahnextCoreyCo-worker on The Wizard of Oz "...those three midgets that came out and danced, the freaked me out when I was little. But they are ok now." |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2005-06-22 : 14:26:41
|
Oh okthankssometimes, you get carried away mixing up SQL statements, .net etc |
|
|
|