Discussion:
Removing a character from string
Richard Mace
2012-11-12 16:16:51 UTC
Permalink
Hi all,
I was sure there was a function to do this, but I can't seem to find it.
How would I remove a character from a string?

Many thanks

Richard
m***@wisa.be
2012-11-12 16:19:16 UTC
Permalink
Post by Richard Mace
Hi all,
I was sure there was a function to do this, but I can't seem to find it.
How would I remove a character from a string?
if P is the position:

Delete(S,p,1);

Note that if S is an UTF-8 string, and at p there is a unicode control code,
this will give unexpected results...

Michael.

--
Richard Mace
2012-11-12 16:21:37 UTC
Permalink
Michael,
Thanks.
What would be the best way of finding the position of char in a string
(Windows only)

Thanks

Richard


*Richard Mace*



*Are you interested in an additional income working part time and without
affecting what you already do?* Then watch this
3minutevideo.co.uk<http://www.3minutevideo.co.uk>
Post by Richard Mace
Hi all,
Post by Richard Mace
I was sure there was a function to do this, but I can't seem to find it.
How would I remove a character from a string?
Delete(S,p,1);
Note that if S is an UTF-8 string, and at p there is a unicode control
code, this will give unexpected results...
Michael.
--
______________________________**_________________
Lazarus mailing list
http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>
m***@wisa.be
2012-11-12 16:24:53 UTC
Permalink
Post by Richard Mace
Michael,
Thanks.
What would be the best way of finding the position of char in a string
(Windows only)
Pos(C,S);

Where C is the char and S the string.

See

http://www.freepascal.org/docs-html/rtl/system/pos.html

Michael.

--

bsquared
2012-11-12 16:21:02 UTC
Permalink
Post by Richard Mace
Hi all,
I was sure there was a function to do this, but I can't seem to find it.
How would I remove a character from a string?
Many thanks
Richard
--
_______________________________________________
Lazarus mailing list
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
StringReplace using EmptyStr as the replacement is one way.
--
Regards,
Brian


--
Loading...