Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-18-2006, 03:39 AM
Hawkeye9165 Hawkeye9165 is offline
Junior Member
 
Join Date: Jan 2006
Posts: 5
Default How do I replace all the tabs with carriage returns in a memo box

Hi,

Could someone please tell me how I can replace all tabs with carriage returns in a memobox without causing the data to go ascew.
By that I mean:

i.e

the data in my memobox is:

01/01/1986 Joe Bloggs 20
12/12/1981 Daryl Crane 25
etc....

I want to replace the tabs so I get:

01/01/1986
Joe
Bloggs
20
12/12/1981
Daryl
Crane
25

Any help would be very much appreciated. Someone tried to help me with a similar problem using a for loop and stringreplace but it didn't work.

Thanks,

Hawkeye9165
Reply With Quote
  #2  
Old 01-18-2006, 03:45 AM
gLes gLes is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,273
Default RE: How do I replace all the tabs with carriage returns in a memo box

Try this:

[delphi]Memo1.Lines.Text := StringReplace(Memo1.Lines.Text, #9, #10#13, rfReplaceAll);[/delphi]

gLes
Reply With Quote
  #3  
Old 01-18-2006, 03:47 AM
mdixon7610 mdixon7610 is offline
Senior Member
 
Join Date: Sep 2003
Posts: 141
Default RE: How do I replace all the tabs with carriage returns in a memo box

Are there more than one tab character between the items?

I don't see why the following code wouldn't work:
[delphi]
Memo1.Text := StringReplace(memo1.Text, #9, #13#10, [rfReplaceAll]);
[/delphi]
Reply With Quote
  #4  
Old 01-18-2006, 06:12 AM
gLes gLes is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,273
Default RE: How do I replace all the tabs with carriage returns in a memo box

Yep, forgot the brackets

gLes
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 07:02 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2017, vBulletin Solutions, Inc.