?
Solved

QUESTION ON WORDS

Posted on 2003-12-03
5
Medium Priority
?
189 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 200 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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month10 days, 20 hours left to enroll

770 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