ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 7th, 2003, 08:44 PM
gurrutello gurrutello is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Spain
Posts: 15 gurrutello User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Get number of lines

hello
Im triying to get the number of lines of a long text from a recordset
if recordset has 100 lines I want to show aside each line a " Line number "
example:


' Results from the recordset <%=rs("description")%>

text text text text text text text text text
text text text text text text text
text text text text text text
text text text text text text text text text
text text text text text text text text text
text text text text text text text

ok there are six lines from a recordset
i want to display in this way

' Formatted Results from the recordset <%=rs("description")%>

1. text text text text text text text text text
2. text text text text text text text
3. text text text text text text
4. text text text text text text text text text
5. text text text text text text text text text
6. text text text text text text text

like a list or like appears for example in dreamweaver or another web editor.

I Know its possible, i have seen this somewhere but i don't remember where.

Sorry for my poor English ( im Spanish )

thank you

Reply With Quote
  #2  
Old October 8th, 2003, 09:45 AM
qsqueeq qsqueeq is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: wilmington, nc
Posts: 13 qsqueeq User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to qsqueeq Send a message via Yahoo to qsqueeq
could you just use a counter starting at 1 and print that right before you print the items from the recordset. then increment the counter when you movenext.
~sam

sorry for my poor english, im american :-P

Reply With Quote
  #3  
Old October 8th, 2003, 04:25 PM
gurrutello gurrutello is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Spain
Posts: 15 gurrutello User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanlk you for your answer
yes is the way im trying to do it but...

Could be like this way
http://www.asptutorial.info/learn/ASP-javascript.asp

look at the tables.
1 text
2 text
3 text
4 text
5 text
6 text
7 text
8 text
9 text
10 text
....


I Know how to get the numbers just looping, but i have to get a total number of lines to display

ex.

number_of_lines=5

count=number_of_lines
Do While count > 0

Response.write count
Response.write "<br>"
count=count-1
Loop


ok this will display numbres from 1 to 5

but how i know how many number_of_lines my recordset have.??

Any help???
Thank you

Reply With Quote
  #4  
Old October 8th, 2003, 04:40 PM
qsqueeq qsqueeq is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: wilmington, nc
Posts: 13 qsqueeq User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to qsqueeq Send a message via Yahoo to qsqueeq
check out this post,http://forums.devshed.com/t49917/s.html, i think it has what you want in reference to finding the count of your recordset. basically you want to do this....
Code:
count = rs.recordcount


hope that will work

Reply With Quote
  #5  
Old October 8th, 2003, 05:37 PM
gurrutello gurrutello is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Spain
Posts: 15 gurrutello User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
repeated message
Please Delete

Last edited by gurrutello : October 8th, 2003 at 05:47 PM.

Reply With Quote
  #6  
Old October 8th, 2003, 05:37 PM
gurrutello gurrutello is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Spain
Posts: 15 gurrutello User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
repeated message
Please Delete

Last edited by gurrutello : October 8th, 2003 at 05:47 PM.

Reply With Quote
  #7  
Old October 8th, 2003, 05:37 PM
gurrutello gurrutello is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Spain
Posts: 15 gurrutello User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
repeated message
Please Delete

Last edited by gurrutello : October 8th, 2003 at 05:47 PM.

Reply With Quote
  #8  
Old October 8th, 2003, 05:37 PM
gurrutello gurrutello is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Spain
Posts: 15 gurrutello User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thank you !!
but is not exactly what i need

rs.recordcount ' Gets the number of records

and i want to get example:

response.write my_recordset("desription")

then it will appears like:

Code:
Neat, eh? There is, however, a much cleaner way for 
counting the number of words in a string and it involves regular 
expressions. (For more information on regular expressions be 
sure to visit the Regular Expressions Article Index!) The regular 
expression to count the number of words in a string uses the non-
greedy repitition pattern matching symbol. This special symbol is 
only available in the regular expression engine that ships with 
the Microsoft Scripting Engines version 5.5 or greater. 
This is an example

Then i want to get the number of lines from this text.
response.write Total_lines
Total lines = 8
Total words = 356 ' I know how to get the total words but not the total lines.

then I can make appears my recordset like

Code:
1. Neat, eh? There is, however, a much cleaner way for 
2. counting the number of words in a string and it involves regular 
3. expressions. (For more information on regular expressions be 
4. sure to visit the Regular Expressions Article Index!) The regular 
5. expression to count the number of words in a string uses the non-
6. greedy repitition pattern matching symbol. This special symbol is 
7. only available in the regular expression engine that ships with 
8. the Microsoft Scripting Engines version 5.5 or greater. 
This is an example

I hope I explained better this time

Last edited by gurrutello : October 8th, 2003 at 05:44 PM.

Reply With Quote
  #9  
Old October 8th, 2003, 10:41 PM
qsqueeq qsqueeq is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: wilmington, nc
Posts: 13 qsqueeq User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to qsqueeq Send a message via Yahoo to qsqueeq
ah ok i get you now... only thing i could think to do would be to count the number of characters total in the recordset then divide this by how long you want your lines to be.... for example you have some text with 300 characters (including spacing, text, numbers, etc.) and you want the lines to be 50 characters long. so that would be you have 300/50 lines or 6 lines. then just do a count where you print out the line number, then characters 0-49, line number, 50-99 .... etc. i hope there is an easier way but this is the only way i can think right off my head.

Reply With Quote
  #10  
Old October 9th, 2003, 02:16 AM
gurrutello gurrutello is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Spain
Posts: 15 gurrutello User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Aleluya!!
Thanks any way, but after 1 full day thinking, i did in this simple way
Code:
<% 
 Dim str, numero_lineas
str = rs("ScriptCode")
str = Trim(str)

Do While InStr(1, str, "  ")
' Convert to Spaces to one
  str = Replace(str, "  ", " ")
' Converting the line words to a long word with no spaces.
  str = Replace(str, " ", "")
  
Loop

Dim aWords
' Conuting the new lines
aWords = split(str, vbCrLf)
numero_lineas = UBound(aWords) + 1
rsponse.write numero_lineas
%>

The rest of the code I do with a counter
Code:
<% counter=1
do until counter=numero_lineas+1
response.write counter
counter=counter+1
loop
%>

It works perfect.

Live demo: http://www.tutores.org/tutores/code...=642&id=1&t=Asp

Thank you

Last edited by gurrutello : October 9th, 2003 at 02:21 AM.

Reply With Quote
  #11  
Old October 14th, 2003, 08:13 AM
Agarash Agarash is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: South Africa
Posts: 53 Agarash User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 35 sec
Reputation Power: 6
great, ive always wondered how one do this. thanks.

i do love my text editting!!!
__________________
"Morgoth i Cried
All Hope is Gone
But i Swear REVENGE
Hear my Oath!!"

Reply With Quote
  #12  
Old October 14th, 2003, 12:01 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,957 Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 15 h 35 m 19 sec
Reputation Power: 802
If your lines are separated by cr-lf characters, something like this can work:
PHP Code:
<%
s1 "This is a test line" vbcrlf "Line 2" vbcrlf "Line 3"
a1 split(s1vbcrlf)
for 
lbound(a1to ubound(a1)
  
Response.Write i ": " a1(i) & "<br />"
next
%> 

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Get number of lines


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |