Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 6th, 2005, 09:52 AM
Friend of Wrox
 
Join Date: Jan 2005
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 ASP Split

How can i split this variable up by the : and the / to get just the value and put it into an array. The output is below.
Code:
theStr = xmldoc.documentelement.selectnodes("dataElementsMaster").item(0).selectnodes("dataElementsIndiv").item(k).selectnodes("miscellaneousRemarks").item(0).selectnodes("remarks").item(0).selectnodes("freetext").item(0).text
Output:

theStr = ADTNN:870.00/WKEND:20.00/ADDON:0.00/MKUP:20.00/AGTMKUP:40.00/FARE:950.00/FUEL:0.00/TAX:134.20/TTL:1,084.20

So, for example. I just want
870.00
20.00
etc...
in an array

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old June 6th, 2005, 10:17 AM
Friend of Wrox
 
Join Date: Jan 2005
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

Adult Net Net ADTNN:870.00/
Weekend Supp. WKEND:20.00/
Pre-Addon ADDON:0.00/
Markup MKUP:20.00/
Agent Markup AGTMKUP:40.00/
Agent Markup (before VAT) 34.04
 FARE:950.00/
Tax (17.5%) 5.96
 FUEL:0.00/
Gross Fare TAX:134.20/
Fuel Surcharge TTL:1,084.20
Tax
TOTAL


www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
 
Old June 6th, 2005, 10:19 AM
Friend of Wrox
 
Join Date: Jan 2005
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

Thats the display im getting in MSIE at the moment. As you can see the display is in the wrong order.

Code:
<%
'... Split the <freetext> XML Reply by : and ,
Dim expression_5: Set expression_5 = New RegExp
expression_5.Pattern = "[^:]*:([^/]*)/?"
expression_5.Global = True
Dim match_5, first_matches_5
Set first_matches_5 = expression_5.Execute(theStr)
'response.write "first_matches_5 = " & first_matches_5 & "<br>"

dim sMyArray_5
sMyArray_5 = Array("Adult Net Net","Weekend Supp.","Pre-Addon","Markup","Agent Markup","Agent Markup (before VAT)","Tax (17.5%)","Gross Fare","Fuel Surcharge","Tax","TOTAL")
sMyArray_5_count = ubound(sMyArray_5)
'response.write "arr_count = " & sMyArray_5_count & "<br>"
counter = 0

'response.write "submatches = " & match_5.submatches(3) & "<br>"
'response.write "first_matches_5 = " & first_matches_5.value  & "<br>"
For i = 1 to (sMyArray_5_count + 1)
    response.Write "<tr bordercolor=#ececec>"
    response.write "<td align=right colspan=30><b>"& sMyArray_5(counter) &"</b>&nbsp;</td>"
'    if figures_written <> true then


    agency_markup_arr = Split(first_matches_5(4),":")
    agency_markup_arr_len = len(agency_markup_arr(1))
    'response.write "agency_markupTEST = " & left(agency_markup_arr(1),agency_markup_arr_len - 1) & "<br>"

    the_agency_markup = left(agency_markup_arr(1),agency_markup_arr_len - 1)

    '... The Value Added Tax (GB Only)
    vat = (cint(the_agency_markup)/47)*7
    the_vat = round(vat,2)
    'response.write "VAT = " & vat & "<br>"
    'response.write "The VAT = " & the_vat & "<br>"

    '... The Agency Markup minus the Value Added Tax (17.5%)
    agency_mkup_minus_vat = the_agency_markup - the_vat


if counter = 5 then
    'response.Write "<td align=right colspan=30>&nbsp;" & first_matches_5(5) & "</td></tr>"
    response.Write "<td align=right colspan=30>&nbsp;" & agency_mkup_minus_vat & "</td></tr>"
    bAgency_mkup_minus_vat = true
end if
if counter = 6 then
    'response.Write "<td align=right colspan=30>&nbsp;" & first_matches_5(6) & "</td></tr>"
    response.Write "<td align=right colspan=30>&nbsp;" & the_vat & "</td></tr>"
    bThe_vat = true
end if
    response.write "<td align=right colspan=30>&nbsp;" & first_matches_5(counter) & "</td></tr>"

bAgency_mkup_minus_vat = false
bThe_vat = false

    agency_markup_arr = Split(first_matches_5(4),":")
    agency_markup_arr_len = len(agency_markup_arr(1))

    the_agency_markup = left(agency_markup_arr(1),agency_markup_arr_len - 1)

    '... The Value Added Tax (GB Only)
    vat = (cint(the_agency_markup)/47)*7
    the_vat = round(vat,2)

    '... The Agency Markup minus the Value Added Tax (17.5%)
    agency_mkup_minus_vat = the_agency_markup - the_vat

counter = counter+1
Next

Set first_matches_5 = Nothing
Set expression_5 = Nothing

response.write "<tr bordercolor=#ececec height=20><td></td></tr>"

end if
next
www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Split function using ASp *Urgent* deean Classic ASP XML 5 June 20th, 2008 05:42 PM
To Split or Not to Split darrenb Access 2 February 8th, 2008 12:28 PM
split() darkhalf Javascript 1 October 21st, 2005 11:34 AM
Split crmpicco VB How-To 6 May 17th, 2005 04:16 AM
split crmpicco Classic ASP Basics 2 February 14th, 2005 08:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.