Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: RE: Reading characters upto commas


Message #1 by Colin.Montgomery@C... on Tue, 9 Apr 2002 14:10:22 +0100
how about:

Replace(strMyString, ",", "<br>")

It'll just replace all commas with the HTML <br> tag which will move to a
new line.

HTH,
Col

-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: 09 April 2002 14:06
To: ASP Databases
Subject: [asp_databases] RE: Reading characters upto commas


Why don't you use the Split command. This will then place your string in an
array, from which you can then write out to the screen in any way you want.

<%
Dim MyArray, MyString

'--- Add your string here
MyString = YOUR STRING HERE

'--- Split it into an array. Use a comma as the separator
MyArray = Split(StringToSplit, ",")
%>


If you had 10 items you can now print them on screen with:

<%
For a=0 to 9
	Response.write MyArray(a) & "<br>"
Next
%>


HTH

Craig.



-----Original Message-----
From: Bobby [mailto:bobby.sojitra@b...]
Sent: 09 April 2002 13:21
To: ASP Databases
Subject: [asp_databases] Reading characters upto commas


Hello. Can anyone help me on how to read characters upto commas (in a
comma seperated list) and display only that word. heres what im trying to
do:

I have a database field of type "memo". It will hold a value such
as "abc1,abc2,abc3". What i want to do is to read in the value of the
field into an asp variable (i.e. - strData = rs.Fields("list").Value). In
this example therefore, "strData" will hold the value "abc1,abc2,abc3".

Then I want to display each item in the list on a seperate line like :

abc1
abc2
abc3

So that i am able to manipulate each item in the list individually. Any
help would be awesome as i am a struggling asp student!!! Cheers dudes.




_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp


_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp



*******

This message and any attachment are confidential and may be privileged or otherwise protected from disclosure.  If you are not the
intended recipient, please telephone or email the sender and delete this message and any attachment from your system.  If you are
not the intended recipient you must not copy this message or attachment or disclose the contents to any other person.

For further information about Clifford Chance please see our website at http://www.cliffordchance.com or refer to any Clifford
Chance office.

Message #2 by "Craig Flannigan" <ckf@k...> on Tue, 9 Apr 2002 14:06:10 +0100
Why don't you use the Split command. This will then place your string in an
array, from which you can then write out to the screen in any way you want.

<%
Dim MyArray, MyString

'--- Add your string here
MyString = YOUR STRING HERE

'--- Split it into an array. Use a comma as the separator
MyArray = Split(StringToSplit, ",")
%>


If you had 10 items you can now print them on screen with:

<%
For a=0 to 9
	Response.write MyArray(a) & "<br>"
Next
%>


HTH

Craig.



-----Original Message-----
From: Bobby [mailto:bobby.sojitra@b...]
Sent: 09 April 2002 13:21
To: ASP Databases
Subject: [asp_databases] Reading characters upto commas


Hello. Can anyone help me on how to read characters upto commas (in a
comma seperated list) and display only that word. heres what im trying to
do:

I have a database field of type "memo". It will hold a value such
as "abc1,abc2,abc3". What i want to do is to read in the value of the
field into an asp variable (i.e. - strData = rs.Fields("list").Value). In
this example therefore, "strData" will hold the value "abc1,abc2,abc3".

Then I want to display each item in the list on a seperate line like :

abc1
abc2
abc3

So that i am able to manipulate each item in the list individually. Any
help would be awesome as i am a struggling asp student!!! Cheers dudes.




_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp


_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
Message #3 by Marijn.Schops@p... on Tue, 9 Apr 2002 14:51:43 +0200
I wouldn't use a memo field for that, had bad experiences with it. I got to
read a little bit more about those BLOB fields, but I avoid them nowadays
as much as possible.
Anyways, you just have to parse the string you get. They are comma
seperated so you just read each character until you find a comma, move that
part into a new variable (or print it immediately) and delete that first
part of the string. Keep doing this until you have read the complete
string.
It's not that difficult, just try it...

Good luck,
Marijn

----------------------------------------------------------------------------------

Marijn Schops
Software Engineer

Professional Interactive Media Centre
Wetenschapspark 5 - 3590 Diepenbeek - Belgium
Tel. +xx-xx-xx xx xx   Fax. +xx-xx-xx xx xx
Email : Marijn.Schops@p...


                                                                                                                   
                    "Bobby"                                                                                        
                    <bobby.sojitr        To:     "ASP Databases" <asp_databases@p...>                      
                    a@b...>            cc:                                                                       
                                         Subject:     [asp_databases] Reading characters upto commas               
                    09/04/2002                                                                                     
                    15:20                                                                                          
                    Please                                                                                         
                    respond to                                                                                     
                    "ASP                                                                                           
                    Databases"                                                                                     
                                                                                                                   
                                                                                                                   




Hello. Can anyone help me on how to read characters upto commas (in a
comma seperated list) and display only that word. heres what im trying to
do:

I have a database field of type "memo". It will hold a value such
as "abc1,abc2,abc3". What i want to do is to read in the value of the
field into an asp variable (i.e. - strData = rs.Fields("list").Value). In
this example therefore, "strData" will hold the value "abc1,abc2,abc3".

Then I want to display each item in the list on a seperate line like :

abc1
abc2
abc3

So that i am able to manipulate each item in the list individually. Any
help would be awesome as i am a struggling asp student!!! Cheers dudes.







Message #4 by "Bobby" <bobby.sojitra@b...> on Tue, 9 Apr 2002 13:20:35
Hello. Can anyone help me on how to read characters upto commas (in a 
comma seperated list) and display only that word. heres what im trying to 
do:
 
I have a database field of type "memo". It will hold a value such 
as "abc1,abc2,abc3". What i want to do is to read in the value of the 
field into an asp variable (i.e. - strData = rs.Fields("list").Value). In 
this example therefore, "strData" will hold the value "abc1,abc2,abc3". 

Then I want to display each item in the list on a seperate line like :

abc1
abc2
abc3

So that i am able to manipulate each item in the list individually. Any 
help would be awesome as i am a struggling asp student!!! Cheers dudes.




  Return to Index