Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parsing db field 1

Status
Not open for further replies.

TheConeHead

Programmer
Aug 14, 2002
2,106
US
How can a take a db field that looks like: (all one long text string)

04/12/06 This is a note 05/16/06 This is another note 6/22/06 Here is a note

and display them as separate entries in the browser like:

04/12/06 This is a note
-------
05/16/06 This is another note
-------
6/22/06 Here is a note

How can I parse that out?

[conehead]
 
may be not an efficient one but an easy one for you to understand...try this code...

Code:
<%
mystring = "04/12/06 This is a note 05/16/06 This is another note 6/22/06 Here is a note"
myarray = split(mystring," ")

for i=0 to ubound(myarray)
	if isdate(myarray(i)) then
		
			do while not i = ubound(myarray)+1
			Response.Write myarray(i)& " " 
				if i = ubound(myarray) then
				exit do
				end if
			if isdate(myarray(i+1)) then
				Response.Write "<BR>"
			end if	
			i = i+1
			loop 
			
	end if
next
%>

-DNG
 
Is there a way to break it up where it finds a carriage return? This is text from a db field... make sense?

[conehead]
 
It's worth noting that you can use the intrinsic constant vbCRLF for chr(10)&chr(13)

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top