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 April 1st, 2005, 07:07 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 cut

This code:
Code:
<%
response.write pnrxml.documentElement.childNodes.item(1).childNodes.item(j).childnodes.item(14).text
%>
gives me either:

Business Class
Economy Class


____________

How do i cut the value by the space?

So that the value is only Business or Economy?

Picco

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old April 1st, 2005, 07:13 AM
Friend of Wrox
 
Join Date: Oct 2003
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

Use substring and extract the text till space.

 
Old April 1st, 2005, 07:16 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

how do i do that?

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
 
Old April 1st, 2005, 07:25 AM
Friend of Wrox
 
Join Date: Oct 2003
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

DO like this...
dim strS = pnrxml.documentElement.childNodes.item(1).childNod es.item(j).childnodes.item(14).text
dim pos = Instr(1,strS," ", CompareMethod.Text)
Response.write Left(strS,pos)

Instr will get the position of the space character and Left will get the extract substring from the text till mentioned position starting from the left.

 
Old April 1st, 2005, 07:31 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

I get error:

Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/mackenzie/asp/multileg3.asp, line 897, column 9
dim strS = pnrxml.documentElement.childNodes.item(1).childNod es.item(j).childnodes.item(14).text

with this code:
Code:
<%
dim strS = pnrxml.documentElement.childNodes.item(1).childNodes.item(j).childnodes.item(14).text
dim pos = Instr(1,strS," ", CompareMethod.Text)
Response.write Left(strS,pos)
%>
thanks for your help btw!

what is wrong with this code?

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
 
Old April 1st, 2005, 07:36 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

I have this code:
Code:
<% if pnrxml.documentElement.childNodes.item(1).childNodes.item(j).childnodes.item(14).text="Economy Class" then%>
              Economy
              <% elseif pnrxml.documentElement.childNodes.item(1).childNodes.item(j).childnodes.item(14).text="Business Class" then%>
              Business
              <% end if %>
but its unsuitable for other classes!

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to cut a substring petergoodman XSLT 2 July 17th, 2008 06:29 AM
Form Short cut mateenmohd Access 2 November 20th, 2007 05:30 AM
Right click cut/copy problem liesmakj Excel VBA 1 July 31st, 2007 09:21 AM
cut it up crmpicco VB How-To 1 March 3rd, 2005 01:57 PM





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