Extract Section Text RRS feed

  • Question

  •  Hi All ,

    I need to get section wise text in a file.

    The is possible format of text.

    1.   Section 1

    1.1.    Sub Section

                    Some Text Here
    2.   Section

           Some Text Here 

            Some Text Here 
    3.   Section 3
            Some Text Here     
            Some Text Here 
            Some Text Here 

    I need to get Section Title(ie;Section1,Section 2......) and Text with in Section inorder to save Section Text along with Section Title in Database.

    Any help is highly appreciated.

    Wednesday, January 7, 2009 9:33 AM


All replies

  • is creation of textfile under your control??
    Wednesday, January 7, 2009 11:45 AM
  • Thanks for your response.

     Ya the file will have same format as above.

    I need to get SectionID(1,2,3....)
    Section Title(Section1,Section2,....)
    Section Text.

    If a Section has sub section it will be considered as Section Text only
    Just we need to get the content of the section.
    Wednesday, January 7, 2009 12:23 PM
  • Well you can use IndexOf function of string to acheive this

    Take contents of file in a string.

    Get the position of Section1 string
    Get the position of Section2 string

    Now extract text between them

    Progressively go on...

    -- Hope this helps

    Wednesday, January 7, 2009 1:22 PM
  • Thanks for your response.

    It will be huge file with text and we need to extract on some pattern.

    Title starting  with numeric etc.

    1. Section1:


    2. Section2:

    just not getting where to start and stucked here.

    Any suggestion is appreciated.
    Wednesday, January 7, 2009 1:41 PM
  • Ok , see if the file is big you can split the contents and process

    Also you will need to modify the algo to get the position of Section(n)

    and then on increasing n

    -- Hope this helps
    Thursday, January 8, 2009 4:39 AM
  • Hey,
    Try Searching for "Regex". Its the .NET implementation of Regular Expression. It can be used to find patterns and extracting them. Hope this helps :)
    Monday, January 12, 2009 11:54 AM
  • Did u get the answer?  Tell me the process plz..

    I have the similar problem..
    Thursday, September 10, 2009 5:40 AM