TMemo string sort optimizing

Hello. Can somebody help me (if it's possible) to optimize my shitty code for a "thanks"? Because the more string there are the more time it takes (in geometrical progression).
{code}
procedure ReplaceDots(InStr: string;i:integer);
var S: string;
begin
 S :=InStr;
 while Pos('.', S) > 0 do S[Pos('.', S)] := ',';
 Form1.Memo1.Lines[i]:=S;
end;
{code}

{code}
procedure ReplaceQuotes(InStr: string;i:integer);
var temp:String;
begin
temp:='"';
while Pos(temp,InStr) > 0 do Delete(InStr,Pos(temp,InStr),1);
Form1.Memo1.Lines[i]:=InStr;
end;
{code}

{code}
procedure FormatInput;
var
 LinesCount:Integer;
 i:Integer;
 s:string;
 Cursor:TCursor;
begin
 Cursor:=Screen.Cursor;
 LinesCount:=Form1.Memo1.Lines.Count;
 for i:=0 to LinesCount do
  begin
  Application.ProcessMessages;
   Screen.Cursor:=crHourGlass;
   Form1.Label1.Caption:='Please wait. '+IntToStr(LinesCount-i)+' lines to go';
   if ((LeftStr(Form1.Memo1.Lines[i],3)='R01') or (LeftStr(Form1.Memo1.Lines[i],3)='901')) then
    begin
     Application.ProcessMessages;
     ReplaceDots(Form1.Memo1.Lines[i],i);
     s:=Form1.Memo1.Lines[i];
     Delete(s,(Length(s)-7),8);
     Form1.Memo1.Lines[i]:=s;
     ReplaceQuotes(Form1.Memo1.Lines[i+2],i+2);
    end; // end IF
 Screen.Cursor:=Cursor;
end; // end FOR
Form1.Label1.Caption:='Done!';
end;
{code}
0
Serhij
8/11/2015 8:03:49 AM
embarcadero.delphi.vcl.using 2297 articles. 1 followers. Follow

0 Replies
271 Views

Similar Articles

[PageSpeed] 58

Reply:

Similar Artilces:

TMemo string sort optimizing [Edit]
Hello. Can somebody help me (if it's possible) to optimize my shitty code for a "thanks"? Because the more string there are the more time it takes (in geometrical progression). {code} procedure ReplaceDots(InStr: string;i:integer); var S: string; begin S :=InStr; while Pos('.', S) > 0 do S[Pos('.', S)] := ','; Form1.Memo1.Lines[i]:=S; end; {code} {code} procedure ReplaceQuotes(InStr: string;i:integer); var temp:String; begin temp:='"'; while Pos(temp,InStr) > 0 do Delete(InStr,Pos(temp,InStr),1); Form1.Memo1.Lines[i]...

To use or not to use Delphi
Sadly, it seems to me that there is a sort of race between the two threads, for and against using Delphi in new projects, with more or less the same users posting in both threads. Arguments are fiercely debated in both camps. Borland had their own vision. As a community, now that Delphi has changed ownership I believe we should try to be more consistent, more clear, and more articulate in what we expect from Embercadero in terms of Delphi. We can contribute to keeping Delphi alive and moving in the right direction. "Laurent Cocea" schrieb: > Sadly, it seems to me that there ...

Trying to use the FAQ " Sorting and paging in the GridView control when not using data source controls "Sorting and paging in the GridView control when not using..."
and I am not getting the results I had hoped for.  I keep getting a "Compiler Error Message: CS0123: No overload for 'AdhocJobGridView_PageIndexChanged' matches delegate 'System.EventHandler'".   Here is my event handling... protected void AdhocJobGridView_PageIndexChanged(object sender, GridViewPageEventArgs e){ try { AdhocJobGridView.DataSource = wsBaseInfoArray; AdhocJobGridView.PageIndex = e.NewPageIndex; AdhocJobGridView.DataBind(); }catch (Exception ex) {throw ex; }   Here is my aspx... <asp:GridView ID="AdhocJobGridView...

How to transform an XML string using a XSLT string without using files?
I am sure I am being a muppet, but I don't seem to be able to find a simple method of doing this and all examples use seperated files especially for the XSLT file. Overview ----------------------------- Basically I have a custom control which gets data from xml and sql server. The data is currently displayed using templated interfaces, but XSLT transformations are now required. Now I do not want a new XSLT file for every instance of the control, and so I have created a public function for the XSLT to be entered. This is all great but I can't find a method of doing the tra...

Firedac
I am using IndexFieldNames to sort a DBGrid using OnClickSort. Is there a way to sort a Text field as a numeric using this method creating Indexes runtime? Database : MySQL You will need use Indexes collection. Define there an index with Expression = 'to_number(field)'. Then specify the index name at dataset IndexName. -- With best regards, Dmitry Arefiev / FireDAC Architect ...

Spreadsheet component for use in Delphi VCL 2010
Good day I have been using the Flexcel component for reading and writing Excel spreadsheets in my Delphi VCL projects for some while and have been very happy. Unfortunately, though, a version for use with Excel 2007 format files (.XLSX) has been promised for years now but just never arrives and I have reached a stage where I just have to update some of my software. Can any body suggest alternatives and comment on their experience with these? I have no objection to buying a component although all my programs are for academic use by myself and colleagues/friends so cheaper would...

Sorting a gridview which uses a dynamic Sql string
Hi, i've got a page with a gridview on it... the grid uses an DataTable as DataSource... the problem is that the DataTable is being build up dynamically:   I Read somewhere here on the forum that i should use a Datview and sort that Dataview instead of the Gridview, so i tried this but still got no success:protected void gridZoekResultaten_Sorting(object sender, GridViewSortEventArgs e){try{ DataView dv = new DataView(new DataAccess().RunSQLDataTable(Session["ZoekProjectSqlCode"].ToString()));dv.Sort = e.SortExpression;gridZoekResultaten.DataSource = dv;}catch (...

using Eval("") on a list of strings, ie using Eval on an object of type System.String
I am trying to use a repater to list string in a collection (List<String> to be exact. ) and I do not know what to put in Eval ( ?? ) to have it simply print out the string. I tried Eval("ToString()") but this does not work and have been looking for a solution without much luck. (PS, there is a reason why I am using a repeater to list strings)  <asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate><li><%# Eval("ToString()") %></li></ItemTemplate> </asp:Repeater> Thank you all for your help...

superreview granted: [Bug 232503] Start using Empty[C]String() : [Attachment 140140] Use Empty[C]String()
Peter Van der Beken <peterv@propagandism.org> has granted Johnny Stenback <jst@mozilla.jstenback.com>'s request for superreview: Bug 232503: Start using Empty[C]String() http://bugzilla.mozilla.org/show_bug.cgi?id=232503 Attachment 140140: Use Empty[C]String() http://bugzilla.mozilla.org/attachment.cgi?id=140140&action=edit ------- Additional Comments from Peter Van der Beken <peterv@propagandism.org> > Index: editor/libeditor/html/Makefile.in > =================================================================== > @@ -58,19 +58,18 @@ CPPSRCS =...

superreview requested: [Bug 232503] Start using Empty[C]String() : [Attachment 140140] Use Empty[C]String()
Johnny Stenback <jst@mozilla.jstenback.com> has asked Peter Van der Beken <peterv@propagandism.org> for superreview: Bug 232503: Start using Empty[C]String() http://bugzilla.mozilla.org/show_bug.cgi?id=232503 Attachment 140140: Use Empty[C]String() http://bugzilla.mozilla.org/attachment.cgi?id=140140&action=edit ...

Delphi XE8 Send Notification from Parse using VCL app
Hello, I am learning the new Baas technology with XE8. I created a small app to receive notification on Android mobiles using Parse. Everything is working fine when the notification message is sent from Parse web site. However when my VCL app send the notification with BackendPush component, nothing is coming in mobile phone. The messages are sending correctly because I can see them on Parse site. Their status is different than the one sent from Parse . Here are my VCL messages Status on Parse: Type: API, target: Chanels. When sent on Parse site: Type : Campaign, Target: Everyone...

superreview requested: [Bug 334189] nsSHistory::PrintHistory should use a string class : [Attachment 218648] reindent file and use string class
timeless <timeless@bemail.org> has asked jag (Peter Annema) <jag@tty.nl> for superreview: Bug 334189: nsSHistory::PrintHistory should use a string class https://bugzilla.mozilla.org/show_bug.cgi?id=334189 Attachment 218648: reindent file and use string class https://bugzilla.mozilla.org/attachment.cgi?id=218648&action=edit ...

Actuall thread about vcl classes / components in C++ for use with delphi...
Hi All, I wanted to follow the topic that appears as a 'sub-thread' above... suspecting it would die... I'm sure many of us are interested in this topic. ( by 'sure' I mean absolutely certain...) It also brings to my mind the question, does anyone know of any references for us semi-delphi-literate C++ programmers that would like to read/write/modify delphi stuff? Thanks Everyone, (you know who you are... B) Bruce ...

superreview granted: [Bug 334189] nsSHistory::PrintHistory should use a string class : [Attachment 218648] reindent file and use string class
jag (Peter Annema) <jag@tty.nl> has granted superreview: Bug 334189: nsSHistory::PrintHistory should use a string class https://bugzilla.mozilla.org/show_bug.cgi?id=334189 Attachment 218648: reindent file and use string class https://bugzilla.mozilla.org/attachment.cgi?id=218648&action=edit ------- Additional Comments from jag (Peter Annema) <jag@tty.nl> Are you re-indenting the whole file, or just that section? ...

Web resources about - TMemo string sort optimizing - embarcadero.delphi.vcl.using

Optimizing compiler - Wikipedia, the free encyclopedia
In computing , an optimizing compiler is a compiler that tries to minimize or maximize some attributes of an executable computer program. The ...

INFOGRAPHIC: Keys To Optimizing Facebook Page Posts
Social analytics firm Quintly examined ways that page administrators can optimize their Facebook posts in a three-part infographic . continued… ...

INFOGRAPHIC: Optimizing your small business page for Facebook Graph Search
Graph Search is rolling out to all U.S. English Facebook users. Is your page ready and Graph Search-friendly? Right On-No Bull Marketing recently ...

iContrast Free - the best image contrast / brightness optimizing app on the App Store on iTunes
Get iContrast Free - the best image contrast / brightness optimizing app on the App Store. See screenshots and ratings, and read customer reviews. ...

#Techonomy2015 discussion at minute 20 in the video: http://techonomy.com/conf/te15/videos-human-val ...
jurvetson posted a photo: Are we optimizing the future? The Techonomy2015 discussion with Jaron Lanier and Sir Colin Blakemore. We begin the ...

Optimizing your Wi-Fi Network as Fast As Possible - YouTube
Wifi optimization tips - some of them are free, some cost money, but they all help save you the headache of dealing with slow, unreliable Internet ...

Optimizing the Sustainable Pace
Sustainable pace is an early Extreme Programming concept that was intended to protect programmers from going on “death marches” to meet deadlines ...

Optimizing Your Pinterest Profile
... is the right time to optimize your Pinterest account if you have one. Why Pinterest Profile Optimization is Important One reason why optimizing ...

INFOGRAPHIC: Why Facebook Pages Should Be Optimizing Their Images For News Feed
There have been several image-sizing guides for page posts , but, as McBeard Media pointed out, 99 percent of Facebook user impressions occur ...

Blizzard further optimizing 'Diablo III' for MacBook Pro Retina display
Though the blockbuster game "Diablo III" currently runs on the new MacBook Pro at the native resolution of its Retina display, developer Blizzard ...

Resources last updated: 1/5/2016 1:08:17 AM