[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

GENERATING PAIR OF WORDS

Posted on 2003-10-24
7
Medium Priority
?
243 Views
Last Modified: 2010-04-16
Dear Friends,


This question I address for Pascal or Delphi programmers.

I would need your help to build a script which will generate a set of pair of all words found in a File putting the list/results of pair of words in another File.

For example:

Source
<FileA>This title will become a featured solution after answer




Results:
<FileB>
This title
title will
will become
become a
a featured
featured solution
solution after
after answer



Hesitate not in contact me for further details.

The points may be increased!

Thank you in advance.


dict
0
Comment
Question by:dict
  • 3
  • 2
  • 2
7 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 9614022
Do you mean as written or in your example is This will a good pair?

mlmcc
0
 
LVL 2

Accepted Solution

by:
MrT-RSI earned 180 total points
ID: 9615232
SpaceIndex := 0;
PrevSpaceIndex := 0;
PrevPrevSpaceIndex := 0;

for Index := 1 to Length(S) do begin {S = your input string}
  if S[Index] = ' ' then begin
    PrevPrevSpaceIndex := PrevSpaceIndex;
    PrevSpaceIndex := SpaceIndex;
    SpaceIndex := Index;
    if PrevPrevSpaceIndex <> PrevSpaceIndex then begin
      Z := Copy(S,PrevPrevSpaceIndex + 1,SpaceIndex - PrevPrevSpaceIndex - 1); {= your output string}
    end;
  end;
end;

Something like this ?

- Rob
0
 

Author Comment

by:dict
ID: 9615970
Yes, more or less in this way.

dict.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:dict
ID: 9634343
Dear MrT-RSI,

I Tested your program in Delphi 5 and BP 7.0

There are two problems in BP.

It not show the last word, for example:

´ I will go to cinema´

 it divides in this way:

I will
will go
go to

So, it shown not the word "cinema"

I added other feature for your program, reading the text from files, then it omit the first and the last word from each line:

For example

I will go to cinema

it shown:

will go
go to

It shown not ´I´ and ´cinema´
 
Please, I would need your helpful to do works fine this program!

Thank you.

dict.
0
 
LVL 2

Expert Comment

by:MrT-RSI
ID: 9635356
come on - be creative !
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 9638869
Seeing as this is probably homework maybe we should let him solve his own problem

mlmcc
0
 
LVL 2

Expert Comment

by:MrT-RSI
ID: 9643698
my idea !
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Will the future of mobile app development include the same trends as those most relevant today? Find out by checking out the 7 trends of the future.
In this article I will be showing you how to subnet the easiest way possible for IPv4 (Internet Protocol version 4). This article does not cover IPv6. Keep in mind that subnetting requires lots of practice and time.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Loops Section Overview

873 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