Solved

A file question.

Posted on 2001-08-24
4
136 Views
Last Modified: 2010-04-06
I have a text file (ie a sql script)
in which I like to lowercase  every string inside [ ] if the text is not [PRIMARY] (if it's [PRIMARY]
i like to keeep it upper-case.

how can I do that?

for example, every apperence of [TABLE_NAME] should be converted to  [table_name]


0
Comment
Question by:hulken
  • 2
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
ITugay earned 100 total points
ID: 6421538
Hi hulken,


var
  S: String;
  C: String;
  I: Integer;
  J: Integer;
  L: TStrings;
begin

  L := TStringList.Create;
  L.LoadFromFile('D:\000.TXT');
  S := L.Text;

  I := 1;
  while (I <= Length(S)) do
  begin
    while (I <= Length(S)) and (S[I] <> '[') do inc(I);
    inc(I);
    J := I;
    while (I <= Length(S)) and (S[I] <> ']') do inc(I);
    C := Copy(S, J, I - J);
    if C <> 'PRIMARY' then
    begin
      C := LowerCase(C);
      Delete(S, J, I - J);
      Insert(C, S, J);
    end;
  end;

  L.Text := S;
  L.SaveToFile('D:\000.TXT');
  L.Free;

end;
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6421554
hu, bytewise, igor?
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6421557
what else :-)

hi igor ;-)
0
 
LVL 9

Expert Comment

by:ITugay
ID: 6421568
hi meikl,
just have few free time to write something :-)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Strange message in Delphi 10 Seattle 1 464
Delphi TcxGrid group footer summary 3 146
Magic Software info 18 105
Dev Express grid collapse 2 34
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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now