Solved

QUESTION ON WORDS

Posted on 2003-12-03
5
180 Views
Last Modified: 2010-04-05
Dear colleagues,

Could you please help me in discovery how I do a function for correction a word?

Example:

I have the following phrase:

ascalPa sia aa anguagela

I would need correct it to:

Pascal is a language

Ho I do this?

0
Comment
Question by:letchev
  • 2
  • 2
5 Comments
 

Author Comment

by:letchev
ID: 9870769
Please, in Pascal language.

letchev
0
 
LVL 2

Expert Comment

by:TheLeader
ID: 9872624
well, you will be in many problems as (dear, read).
but i think you can write the correct words as a dictionary, and ofcourse in database, this is as first step.
second read word by word from the text file.
any word you didn't find it in the database, you should show the alternative.
if you would like your program to do exactly the same as your example, you should devide the word as characters and compare them to get the result as you wish.

hope it helped ...
0
 
LVL 17

Accepted Solution

by:
geobul earned 50 total points
ID: 9874989
Hi,

In your example above there are two errors on each word:

1. an extra 'a' is added at the end - remove it.
2. the last letter should become the first one - move it there.

function CorrectAWord(const SourceWord: string): string;
begin
  result := Copy(SourceWord,1,Length(SourceWord) - 1); // remove the last char
  result := Copy(result, Length(result), 1) + Copy(result, 1, Length(result) - 1);
end;

Regards, Geo
0
 

Author Comment

by:letchev
ID: 9875390
Geobul,

Many Thanks. Pascal is an imortal language.

Best regards,

letchev
0
 
LVL 17

Expert Comment

by:geobul
ID: 9875424
Always glad to help :-)
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now