Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

A file question.

Posted on 2001-08-24
4
Medium Priority
?
144 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

618 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