Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 10th, 2005, 05:38 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default string split by :

My original string:

ADULT NETNET:134,GROSS:169,TAX:69.70,ADDON:35,WKEND:0,FU EL:0,MRKUP:0,AGYMRKUP:0,FEE:0,TTL:273.70,CID/CTC: 39/IT5AFKLE


My code:

<%
dim arrStr
dim theStr

theStr = xmldoc.documentelement.selectnodes("dataElementsMa ster").item(0).selectnodes("dataElementsIndiv").it em(2).selectnodes("miscellaneousRemarks").item(0). selectnodes("remarks").item(0).selectnodes("freete xt").item(0).text
'response.write "theStr = " & theStr & "<br>"
arrStr = Split(theStr,",")

for i=0 to Ubound(arrStr)
     response.write "arrStr = " & (arrStr(i)) & "<br>"
next
%>

My output:

arrStr = ADULT NETNET:134
arrStr = GROSS:169
arrStr = TAX:69.70
arrStr = ADDON:35
arrStr = WKEND:0
arrStr = FUEL:0
arrStr = MRKUP:0
arrStr = AGYMRKUP:0
arrStr = FEE:0
arrStr = TTL:273.70
arrStr = CID/CTC: 39/IT5AFKLE

How can i split the string up even further to get just what comes after the ':'

Thanks.

Picco


www.crmpicco.co.uk
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
Reply With Quote
  #2 (permalink)  
Old February 10th, 2005, 06:25 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Chennai, TamilNadu, India.
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

For each array element string,extract string after : and store it in one more array inside the loop.




Reply With Quote
  #3 (permalink)  
Old February 10th, 2005, 06:26 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Picco,

I would use a regular expression - well worth looking into if you're going to do much in the way of string manipulation. Try this...
Code:
Dim expr: Set expr = New RegExp
expr.Pattern = "[^:]*:([^,]*),?"
expr.Global = True
Dim match, matches
Set matches = expr.Execute(theStr)
For Each match In matches
    response.write "item = " & match.SubMatches(0) & "<br />"
Next
Set matches = Nothing
Set expr = Nothing
HTH,

Chris

Reply With Quote
  #4 (permalink)  
Old February 10th, 2005, 07:49 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

that works excellent - thank you very much mate

www.crmpicco.co.uk
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to split string krevathi1912 Access VBA 10 September 6th, 2007 02:21 AM
string split vidhya XSLT 1 August 10th, 2005 04:53 AM
How to split a string lily611 General .NET 5 March 18th, 2005 01:16 PM
String.Split bbhill General .NET 2 April 10th, 2004 05:53 PM



All times are GMT -4. The time now is 03:55 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.