Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Old 01-05-2006, 06:36 AM Help With VBscript
waller's Avatar
Skilled Talker

Posts: 59
Location: North Borneo.
Trades: 0
I am using VBscript in a asp file.
lets say I have a value...

abc="JDD-20015-19,12"
def="JDD-20015-07,8"


Question (1)
How can I strip everything except
the one after the comma(,) ?
I mean, after I strip 'abc',all that is left is '12' and
after I strip 'def',all that is left is '8'.



Question (2)
How can I strip everything except
the two number before the comma(,) ?
I mean, after I strip 'abc',all that is left is '19' and
after I strip 'def',all that is left is '07'.



I'm an ultimate beginner in VBscript.
Help is really appreciated.
Thanks Very Much...
__________________
$id ="waxxer";
$id = str_replace('x', 'l', $id);
echo $id;
echo " and Marj";
waller is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-05-2006, 07:44 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
BTW this is the javascript forum ASP is on the next floor up

use the split() function with "," as the delimiter
Code:
function strSplit(strIn)
strSplit = split(strIn,",")
end function
useage
Code:
abc = "JDD-20015-19,12"
arrValues = strSplit(abc) 
' arrValues(0) = "JDD-20015-19"
' arrValues(1) ="12"
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-05-2006, 10:02 AM
waller's Avatar
Skilled Talker

Posts: 59
Location: North Borneo.
Trades: 0
Thanks a lot man.
__________________
$id ="waxxer";
$id = str_replace('x', 'l', $id);
echo $id;
echo " and Marj";
waller is offline
Reply With Quote
View Public Profile
 
Old 01-05-2006, 10:11 AM
waller's Avatar
Skilled Talker

Posts: 59
Location: North Borneo.
Trades: 0
still trying to figure out the second problem though...
__________________
$id ="waxxer";
$id = str_replace('x', 'l', $id);
echo $id;
echo " and Marj";
waller is offline
Reply With Quote
View Public Profile
 
Old 01-05-2006, 10:54 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
use a similar function except split on "-" the grab the last array element.

Code:
function split2(strIn)
strArr = split(strIn,"-")
split2= strArr(ubound(strArr))
end function
simply feed the output from the first function into split2

var = split2(arrValues(1))


BTW haven't tested any of these
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-05-2006, 08:56 PM
waller's Avatar
Skilled Talker

Posts: 59
Location: North Borneo.
Trades: 0
Hey, I never thought of it that way. It works man. Thanks a lot.
__________________
$id ="waxxer";
$id = str_replace('x', 'l', $id);
echo $id;
echo " and Marj";
waller is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Help With VBscript
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18581 seconds with 12 queries