Solved

QUESTION ON WORDS

Posted on 2003-12-03
5
185 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
[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
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

730 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