Subject:
|
Re: I need help on Delphi so I can finnish my program
|
Newsgroups:
|
lugnet.cad.dev
|
Date:
|
Mon, 16 Sep 2002 16:55:03 GMT
|
Viewed:
|
477 times
|
| |
| |
In lugnet.cad.dev, Eduardo Vazquez Harte writes:
> I don't understand this hope there is another easy way.
>
> In lugnet.cad.dev, Orion Pobursky writes:
> > In lugnet.cad.dev, Eduardo Vazquez Harte writes:
> > > How can I change a leter of a current selected
> > > line?
> > >
> > > example 1
> > >
> > > 0 3 0 5 0 0 1
Please don't take this the wrong way, but if you didn't understand what he
wrote, then you would probably find it a lot less frustrating to spend some
more time learning how to use Delphi, and programming techniques in general.
I've never programmed in Delphi, and the last Pascal programming I did was
over 10 years ago, without any objects. However, Orion's reply made perfect
sense to me.
He was instructing you to use ExtractStrings to create an array of words
(stored in StringList). Then you can change the appropriate word in the
array, and then use a loop to reconstruct the original string with the one
word changed.
This may seem like a lot of work just to change a single word in a string,
and there may well be an easier way, but quite frankly it's a trivial amount
of work in the overall scheme of a program. If you expect to do it multiple
times, stick it in a function or a member function, and then call that
function when you want to do this. That's how programming works.
Actually Orion's solution looks relatively straightforward. It's very
inefficient, but I really don't think that's an issue in this case, and
doing it in a more efficient way would probably be much more difficult and
error-prone. However, I'd be pretty surprised if there wasn't an inverse of
ExtractStrings, to put the string back together again, which would allow you
to avoid the for loop at the bottom. I would expect a well-constructed
class library that has string to array functionality also have array to
string functionality.
--Travis Cobbs (tcobbs@REMOVE.halibut.com)
|
|
Message has 1 Reply:
Message is in Reply To:
10 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|