Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CREATING SUBSTRINGS

Posted on 2003-10-30
7
Medium Priority
?
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 200 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Check out what's been happening in the Experts Exchange community.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

721 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