VB .NET String Manipulation

Posted on 2011-05-05
Last Modified: 2012-05-11
Let's say I have a paragraph with three sentences each sentence ends in a period. I need to break apart the paragraph and assign each sentence to a string. For example:

Paragraph String: This is s.entence one. This is s.entence two. This is an ex.ample of sentence three.

I need to store it as follows:

String1 = This is s.entence one
String2 = This is s.entence two
String3 = This is an ex.ample of sentence three

(Note: there are periods within the sentences but no trailing spaces after the period within the sentence)

How can I tackle this one?
Question by:disrupt
    1 Comment
    LVL 12

    Accepted Solution


    Dim str As String = "This is s.entence one. This is s.entence two. This is an ex.ample of sentence three."
            Dim splitStr() As String = Split(str, ". ")
            For Each sentence In splitStr

    Open in new window


    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Do you hate spam? I do, and I am willing to bet you do as well. I often wonder, though, "if people hate spam so much, why do they still post their email addresses on the web?" I'm not talking about a plain-text posting here. I am referring to the fa…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now