Link to home
Start Free TrialLog in
Avatar of Wayne Barron
Wayne BarronFlag for United States of America

asked on

Loop through text

Hello All

I need to loop through text that resembles that below.
I need to replace the
--message information here--
and what is contained within it to the next
--message information here--
(Please look below)

Example
Find          --message information here--
and replace it with
<div>
bla bla bla bla bla bla bla bla bla bla bla bla

and once it gets to the end, add the ending   </div>

So, if there is 4  --message information here--
then it would need to be something like this.

<div>bla bla bla</div
<div>sha sha sha</div>
<div>dah dah dah</div>
<div>wha wha wha</div>

Hope that it is clear enough, I just woke up with this in my head of what I was trying
To do earlier, and well, here it is.

Almost forgot.
This is being read from a recordset, incase it is needed
Would be example:  rs("MyField")

Thanks All
Carrzkiss
--message information here--
bla bla bla bla bla bla bla bla bla bla bla bla
--message information here--
sha sha sha sha sha sha sha sha sha sha 
--message information here--
dah dah dah dah dah dah dah dah dah dah dah 
--message information here--
wha wha wha wha wha wha wha wha wha wha

Open in new window

Avatar of rg20
rg20
Flag of United States of America image

If you are reading from a recordset, you could have a loop


startmessage = "--message information here --"
while not rs.eof
     if rs("startMessage") = startmessage then
           rs.movenext
           string = rs("data")
           string = replace(string,string,"<div>"&string)
           string = replace(string,string,string&"<div>")
     end if
     rs.movenext
wend
Avatar of Wayne Barron

ASKER

cant seem to get it to work.
Will mess with it a little later on today, Have a lot of files to go through where I need to close
Some 50+ recordSets, busy day.

Thanks rg20, if you can test this on your side, that would be awesome.
have a good one
Carrzkiss
Avatar of ArachnidCreations
ArachnidCreations

Do you still need help with this?
Hello Arachnid
Would love to have help with this one.
Thanks in advance.

Carrzkiss
how about it [ArachnidCreations]
Where you just coming in to come in because you could,
or do you actually have an idea on how to accomplish this feat?
Carrzkis,

Sorry I havent responded to this.

Is this coming from a excel file, txt or other?

Are you running a query against it, if so, can you provide a sample of the file so I can look at it here?

I just had IIS installed on my laptop.
I have ran into a HUGE issue over here.
And will not have the time to make up a demo at the moment.

Just create a simple database Access
And in a field (memo)
And add the following to the Default value of the Memo Field.
Then call it to your page.

rs("MyField")

I have to get back to fixing what I just messed up.
It is going to be a long day/night..... this sucks....
--message information here--
hello bla, bla and some more bla
--message information here--
hello again with all the bla's
--message information here--
this is just some more bla bla
--message information here--
what about some more bla bla bla bla.

Open in new window

I am so happy.
Problem was not as big as I thought it was.
I deleted a Temp table that I created in SQL Server, and it deleted one of my main tables.
I opened up another instance of SQL Server 2005, and wa-la
There was me table.... I am so, so happy now.

OK.
On to this issue.
Demo
http://ee.cffcs.com/Q_24639205/Q_24639205.asp
Code
http://ee.cffcs.com/Q_24639205/Q_24639205.zip

What I would like to have happen here is to have the

--message information here--

Found within the text, and replace it with another set of characters.
For this demo, lets replace it with
<tr><td>
And then at the end of the text under it, add in  </td></tr>

So, in retrospect, it would turn this

--message information here--
hello bla, bla and some more bla
--message information here--
hello again with all the bla's
--message information here--
this is just some more bla bla
--message information here--
what about some more bla bla bla bla.



Into this

<tr><td>hello bla, bla and some more bla</td></tr>
<tr><td>hello again with all the bla's</td></tr>
<tr><td>this is just some more bla bla</td></tr>
<tr><td>what about some more bla bla bla bla.</td></tr>


Hope that this makes since.

Have a good one.
Carrzkiss
rg20
I am using my Laptop to disign all my site(s).
Running
WInXP Pro MCE SP3 with IIS5.1
Microsoft Office suite 2007 and SQL Server 2005 Enterprise 180day trial
Of which I will be purchasing before the trial expires.
I do ASP Classic and CSS (Learning a great deal about it over the last few months)
ASP .NET I do not do, have not get the time to learn it, and not really sure that I want to
This late in the game.
I will leave it for the younger generation. I am 38, and it has taken me 6yrs to get to the point I am at now.
Cannot see jumping in and learning something else when I can do "Almost" anything I want to do with Classic ASP. (And AJAX is a life saver as well, very sweet)

My laptop is my life-line, if it was not for it, I would lose my mind.

Going to step out for a little while.
Got stressed and mad over nothing a little while ago, and now I have to cool myself down a little.

Carrzkiss
ASKER CERTIFIED SOLUTION
Avatar of rg20
rg20
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You ROCK my friend.
And no problem with the delay.

The site is fixing to go life, so this will have to be added into it as a "MOD"
Later on down the road.

Thank you for your time.
Today, you are my hero :)

Have a good one.
Carrzkiss
You ROCK my friend.
And no problem with the delay.

The site is fixing to go life, so this will have to be added into it as a "MOD"
Later on down the road.

Thank you for your time.
Today, you are my hero :)

Have a good one.
Carrzkiss