|
|
#1 |
|
Junior Member
Join Date: Aug 05
Location: perth
Posts: 30
![]() |
Below is my coding for the counting of sentences in a paragraph of inputted text. So far though i can only get it to count full stops (eg. however many full stops there are there are sentences.). What if i had a question mark though, because that would be the end of a sentence too???? so how do i include question marks in the code below to count question marks AND full stops. (eg. however many full stops AND question marks there are sentences).
hope u caught my drift!! VB Code:
|
|
|
|
|
|
#2 |
|
Banned
Join Date: Jun 04
Location: Center of it all
Posts: 17,901
![]() ![]() ![]() ![]() ![]() ![]() |
Re: counting question marks and full stops.
If it's formatted correctly, you could check for two spaces, which should be between the period and the next sentence. Same from a question mark.
Otherwise, change it to this: VB Code:
|
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Aug 05
Location: perth
Posts: 30
![]() |
Re: counting question marks and full stops.
THANKYOU!!!!
we have the "or" inbetween but i didnt realise that you had to have char= twice!! thanks! it works in other words..could you tell :P |
|
|
|
|
|
#4 |
|
Lively Member
Join Date: Jul 05
Location: Brisbane, Australia
Posts: 119
![]() |
Re: counting question marks and full stops.
Don't forget sentences can finish with an exclamation point to!
And does it mater if people over puncuate??? (this would be 3 sentences to you code) Just some things to consider.
__________________
Despite body and mind, my youth will never die! Everytime I learn something new it pushes some old stuff out of my brain! |
|
|
|
|
|
#5 |
|
Re: counting question marks and full stops.
Here's another way.
VB Code:
__________________
Tips, Examples & Tutorials: A valuable forum tool • Generate unique TreeView keys • TreeView with "open" and "closed folder" icons • Time code using GetTickCount • How to trap the Tab key • Scroll a form • NumberBox ActiveX control • Color a ListView row • An InputBox form • How to use SaveSetting and GetSetting • A program registration scheme • Spellcheck a Textbox • Resize controls • Open Windows Explorer at Last Visited Path • A Blackjack Game • Count lines of code • Please go to the Thread Tools menu and click Mark Thread Resolved when you have your answer. If someone helped you today then please consider rating their post.
|
|
|
|
|
|
|
#6 |
|
Re: counting question marks and full stops.
Oh, wait, "THANK YOU!!!!" is a valid sentence!
__________________
Tips, Examples & Tutorials: A valuable forum tool • Generate unique TreeView keys • TreeView with "open" and "closed folder" icons • Time code using GetTickCount • How to trap the Tab key • Scroll a form • NumberBox ActiveX control • Color a ListView row • An InputBox form • How to use SaveSetting and GetSetting • A program registration scheme • Spellcheck a Textbox • Resize controls • Open Windows Explorer at Last Visited Path • A Blackjack Game • Count lines of code • Please go to the Thread Tools menu and click Mark Thread Resolved when you have your answer. If someone helped you today then please consider rating their post.
|
|
|
|
|
|
|
#7 |
|
Super Moderator
Join Date: Jan 05
Location: Sunny Adelaide
Posts: 12,738
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: counting question marks and full stops.
Courtesy of yrwyddfa and I, with a few slight modifications:
VB Code:
|
|
|
|
|
|
#8 |
|
Junior Member
Join Date: Jun 05
Posts: 22
![]() |
Its not a very good way of counting sentences. But rather number of occurances of fullstops, question marks and exclamation marks. To increase accuracy try counting a trailing space. Like count for ". " and "? " etc. And dont forget to add 1 to count for the last sentence. This way confusions made by sentences like "Thank you!!!" will be eliminated. Actually its just more accurate way not foll-proof. More accurate count requires more sophisticated and complex code.
|
|
|
|
![]() |
|
||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|