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
Solved

QUESTION ON WORDS

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
error 1.1 400 Bad request idhttp delphi 18 147
Delphi Yen format 3 45
RESTRequest Parameter 4 42
shape, triangle, dbctrlgrid 3 17
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 The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

860 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