I have texts (Paragraphs) and I want to replace each of annotated wrong word in the paragraph with the correct word indicated by the position (index) number of the wrong word and i need to do it for each paragraph... So, what method should I use to search by index number? thank you

Example:

In the input file you have the following paragraph:

Computer Science are the study of principles applications, and technologies of computing & computers. It involve the studyof data and data structures...

The above text should be replaced by the following paragraph in the output file:

Computer Science is the study of principles, applications, and technologies of computing and computers. It involves the study of data and data structures...

**Note that the numbers (e.g:2 3) indicate the position (index) of the wrong word

A 2 3|||Edit||| is |||REQUIRED|||-NONE-|||0

A 12 13|||Edit||| and |||REQUIRED|||-NONE-|||0

A 15 16|||Edit||| involves |||REQUIRED|||-NONE-|||0

A 18 19|||Split|||study of|||REQUIRED|||-NONE-|||0

A 29 29|||Add_before|||.|||REQUIRED|||-NONE-|||0

If you split the para by white space you will get an array of al the words, so each word will have its own array index (ignoring puncuation for the moment!).

You may have problems with the subsequent index numbers changing when you split add or remove words

commented: ok thanks for explaining, can you tell me how do i search by index? what's the syntax? +0

After using String's split method (read the API doc) you have an ordinary array of Strings, which you can search with a for loop just like any other array

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.