?
Solved

A file question.

Posted on 2001-08-24
4
Medium Priority
?
142 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
ITugay earned 400 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

752 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