Solved

QUESTION ON WORDS

Posted on 2003-12-03
5
181 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi 2010 Export to pdf 2 287
FMX and jaudiotracker playing memory stream 29 66
Base1 Encode/Decode 3 68
Installshield for Embarcadero EX 10.1 Berlin 4 20
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

895 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

13 Experts available now in Live!

Get 1:1 Help Now