473,396 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Need Help With VBscript


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...:)

--
AutoShutdown
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Jan 10 '06 #1
3 1993
"AutoShutdown" <Au*****************@mail.codecomments.com> wrote in message
news:Au*****************@mail.codecomments.com...

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'.

new abc = Mid(abc,InStrRev(abc,",")+1)

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'.

newabc = Mid(abc,InStrRev(abc,"-")+1)
newabc = Left(abc,InStr(abc,",")-1)

I'm an ultimate beginner in VBscript.
Help is really appreciated.
Thanks Very Much...:)


Get a hold of the VBScript documentation at:
http://msdn.microsoft.com/scripting

<URL:
http://msdn.microsoft.com/library/de...us/script56/ht
ml/0a8270d7-7d8f-4368-b2a7-065acb52fc54.asp>

Jan 10 '06 #2
On Thu, 5 Jan 2006 04:28:33 -0600, AutoShutdown
<Au*****************@mail.codecomments.com> wrote:

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'.
Best method would be RegExp, though a split might get what you're
looking for.
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'.


Same thing.

See:

http://www.4guysfromrolla.com/webtech/090199-1.shtml

Jeff
Jan 10 '06 #3
AutoShutdown wrote:
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'.
Use the Split() function to split the string on the comma, putting the
results into an array:
ar=split(abc,",")

The last element in the array will contain the substring you want.
newstring=ar(ubound(ar))


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'.
Split the penultimate element in the array created by the first split using
the hyphens to do the split:

ar2=split(ar(ubound(ar)-1),"-")

Again, the last element in the new array will contain the string you want:
secondstring=ar2(ubound(ar2))

I'm an ultimate beginner in VBscript.
Help is really appreciated.
Thanks Very Much...:)


You can download the vbscript documentation here:
http://tinyurl.com/7rk6

HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jan 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jill | last post by:
I am trying to store the current date to an ms access database on my server. I set it up with a dsnless connection. Here is the statement: Insert Into employees(timestamp) Values ('" & date() &...
1
by: pmarisole | last post by:
I need help in calculating a score from a row of drop-down values. I need to use the onChange to tally the score as the user moves across 9 categories (with drop-down selection of 1-9 or N/A)...
10
by: brooksr | last post by:
I know VB5/VBA very well but have not used VB to create web pages but need to do so. Can someone explain the purposes and differences between VBScript and VB.NET to create web pages? Also...
102
by: BoogieWithStu22 | last post by:
I am running into a problem with a web page I have created when viewing it in IE6 on some machines. The page has a database lookup. The user enters an account name or number and clicks a lookup...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.