Solved

CREATING SUBSTRINGS

Posted on 2003-10-30
7
216 Views
Last Modified: 2010-04-16
Dear Pascal Experts,

Could you please help me for building a program to create two lists of words or substrings from a list of compound words?

For example:

If I have the following list:

brief overview
be concise
enough information
your question

.........
etc. etc.

How I create two different lists. The first with the first word and the
2nd list with the second word?

In this way:

1st list:

brief
be
enough
your

2nd list:

overview
concise
information
question

Thank you for your help.

EN
0
Comment
Question by:eminitta
  • 3
  • 2
7 Comments
 
LVL 11

Expert Comment

by:bcladd
ID: 9649557
Sounds a lot like homework.

We would be happy to help you track down problems in your code or answer specific questions but this is not a place where we do homework.

That said:

You will want to be able to read all the lines from the file.

Having read a line into a string you will want to split it on a space. Finding where the space is will use the Pos function; splitting it will use the Copy  function.

You will want to have arrays of strings for first words and for second words.

Hope this helps, -bcl
0
 

Author Comment

by:eminitta
ID: 9656905
There is not a homework.

Ok. I found the right substring and left substring from a pair of words.

AHA! and if I need separate the middle words in phrases with three words?

Thank you.

EN

0
 
LVL 11

Accepted Solution

by:
bcladd earned 50 total points
ID: 9657108
If you know the string is separated by spaces you could try writing a procedure that takes two string variables by reference, the first word variable and the whole string. Your procedure could use what you have figured out to slice off a word from the front of the second parameter, place the word in the first parameter, and modify the second parameter to be the rest of the string. That is:

Line := 'This is a test';
Word := '';

nextWord(Word, Line);
{ Now Word = 'This' and Line = 'is a test' }

nextWord(Word, Line);
{ Word = 'is', Line = 'a test' }


This would permit you to easily handle any number of words.

-bcl

0
 
LVL 11

Expert Comment

by:bcladd
ID: 9681786
My not so humble opinion is that I answered the question(s) posted.

Thus I am sure that there should  be no refund of points. I don't particularly care about points so I won't argue for awarding them to me.

-bcl
0
 

Author Comment

by:eminitta
ID: 9685928
I asked for a solution, not sparse code lines. So, my question was not answered as I want.

EN
0

Featured Post

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Lazarus (freePascal) DB Project Assistance 14 481
Conversion ? 15 92
indy Tidtcpserver best  way to brodcast message to multiable clients 1 162
Mydac connection data base issue 3 166
Are client relationship the only driver of a successful MSP? While important, client relationships are only one component. Learn how else MSPs can broaden their horizon and differentiate themselves.
This article describes how to reset your Windows 10 password when you've forgotten it.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

789 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