473,748 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vb.net extract first sentence in paragraph

Hi,

For string extraction function in vb, if I feed in a paragraph, how do
I extract the first sentence of that paragraph.

Thanks

:D
Nov 12 '08 #1
3 5036
re:
!For string extraction function in vb, if I feed in a paragraph, how do
!I extract the first sentence of that paragraph.

Dim sr As New IO.StreamReader ("drive:\direct ory\somefile.tx t")
sr.ReadLine()

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
<dm**********@y ahoo.comwrote in message news:5e******** *************** ***********@d42 g2000prb.google groups.com...
Hi,

For string extraction function in vb, if I feed in a paragraph, how do
I extract the first sentence of that paragraph.

Thanks

:D


Nov 12 '08 #2
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>For string extraction function in vb, if I feed in a paragraph, how do
I extract the first sentence of that paragraph.

Dim sr As New IO.StreamReader ("drive:\direct ory\somefile.tx t")
sr.ReadLine()
Will that work if the first sentence is more than one line long? Or if the
first sentence is only a few words long?

Don't you need to do some sort of regular expression where you find the
first instance of a full stop followed by a space and a capital letter...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 12 '08 #3
re:
!Will that work if the first sentence is more than one line long?
!Or if the first sentence is only a few words long?

That should read until the first line-break is found.
Some care will need to be taken when writing that first line. <g>

There's additional caveats, like if the punctuation includes a semi-colon.

Everything before the semi-colon will be interpreted as a line
and everything past the semi-colon ( and until the line-break)
will be interpreted as a second line.

re:
!Don't you need to do some sort of regular expression where you find the
!first instance of a full stop followed by a space and a capital letter...?

Finding the first period and reading everything that came before it would turn the trick, too.
There's also caveats with that method.

See my sig for an example : "Juan T. Llibre, asp.net MVP"

That line has a period followed by a space and a capital letter...but the line doesn't end there.

Bottom line: the problem is a tough nut to crack because of the infinite possibilities in text.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message news:u1******** ******@TK2MSFTN GP06.phx.gbl...
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>>For string extraction function in vb, if I feed in a paragraph, how do
I extract the first sentence of that paragraph.

Dim sr As New IO.StreamReader ("drive:\direct ory\somefile.tx t")
sr.ReadLine( )

Will that work if the first sentence is more than one line long? Or if the first sentence is only a few words long?

Don't you need to do some sort of regular expression where you find the first instance of a full stop followed by a
space and a capital letter...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 12 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2130
by: grghoward | last post by:
I am receiving a series of Microsoft Word documents from web clients that they upload to my server. I need to convert them to XML to pass through to another system. I have done this through Microsoft Word 2003 with the "Save as XML" option. Now the tricky part is that a portion of these documents contains a numbered outline. Unfortunately, I need to remove the numbering before passing the data to the next system. Here is an example of...
5
5159
by: Mel | last post by:
i want to have a block, like some articles i see, with the first char (very Fancy and huge) and have the rest of the block kind of wrap around this char (to the right of). something like below where FFFs are the fancy first char FFFFF fdafdfdsf fd afd fda fd fadf ds FFF fdfd fasd fd fads fdasf dsaf FFFFFFFFF fdafdfdsfdf fdsa fdsf adsf df a fdsaf df adsf df ad fdas fdsf
6
16619
by: Veerle | last post by:
Hi, Somewhere in my html page, I have the following code: <div id="main-body"> <h2>Header text</h2> <p>Some other text ...</p> ..... <h2>Another header text</h2> <p>Some more other text ...</p>
44
12742
by: RB | last post by:
How to extract bytes from long, starting from the last byte? For example, I have a long number: 0x12345678 I need to represent it as the following bytes list: 0x78, 0x56, 0x34, 0x12 Thanks in advance, Rita
7
2896
by: teo | last post by:
hallo, I need to extract a word and few text that precedes and follows it (about 30 + 30 chars) from a long textual document. Like the description that Google returns when it has found a given word. In example from:
0
1303
by: kamal9 | last post by:
#include <stdio.h> #include <string.h> void string2Lines(char line, char tokens){ char *token_ptr, token; char *i=";" " " "," "." "?" "!"; token_ptr = strtok(line, i ); while(token_ptr){ strcpy(token, token_ptr); strcat(tokens, strcat(token,"\n"));
0
2198
by: visu | last post by:
I ve a text paragraph something like sample sample sample sample rr@yahoo.com <ee@ss.comsample sample sample sample sample sample sample sample sample sample ds@example.com sample sample sample <ww@example.comsample sample sample sample sampl yy@sample.com i want to extract email ids from the above text paragraph.. using Active server pages or php can u give me some clue to find a
3
2472
by: suzanne.boyle | last post by:
Hi I have an html file with headings followed by one or more paragraphs like this <h2>blah blah 1</h2> <p>more blah blah blah</p> <h2>blah blah 2</h2> <p>more blah blah blah</p>
2
1848
by: whodgson | last post by:
The following code accepts a string from the user and swaps the first and last letters in each word. It prints out the original string incorrectly by dropping off the first letter of the first word. I would like to establish what error in the code is causing the first word to be mangled. #include<iostream> #include<cstring> #include<cstdlib> using namespace std; int main() { cout<<"Transposing letters in a string \n"; cout<<"Type a...
0
8831
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9249
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8245
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4877
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.