Avatar of zotdog69
Flag for United States of America asked on

Not exactly what was asked for...

This was the original question:
Lowercase problems...Question: I'm working on a program for changing uppercase letters to lowercase. This is what I have so far:
class lowercase
Set objFileSystem = CreateObject("Scripting.fileSystemObject");
Set objOriginalFile = objFileSystem.OpenTextFile(OriginalFile,1,True)
Reader = objOriginalFile.ReadAll;

LowerCaseReader = LCase (Reader);
Set objEndFile = objFileSystem.OpenTextFile(EndFile,2,True);
objEndFile.Write LowerCaseReader;
Set objEndFile = Nothing;
Set objOriginalFile = Nothing;
Set objFileSystem = Nothing;
And these are the errors I'm getting:lowercase.java:6: <identifier> expected
Reader = objOriginalFile.ReadAll;
lowercase.java:7: <identifier> expected
objOreginalFile.Close;// read from the file then close the file
lowercase.java:9: <identifier> expected
LowerCaseReader = LCase (Reader);//converts all to lower Case
lowercase.java:12: <identifier> expected
objEndFile.Close;//write all to the end file
4 errors
Along with the obvious errors up top, I have researched the answers on how to create a file .TXT, but am very unsure of how to do it. Keep in mind, I'm running Coderunner (MAC) and don't know if it can import/export to a file.
Thanks, this is the last program I HAVE to do, so now I can start doing programs I want to do!"

And this was the proposed solution:
"This one does what you want:

 import java.io.*;
public class LowerCase{
public static  void toLowerCase(String inFile, String outFile) throws IOException {

                  BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(inFile)));

                BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(inFile)));
                 out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile)));

                String line;
                while((line = in.readLine()) != null)
                      out.write(line.toLowerCase() + "\n");


      public static void main(String[] args) {

        toLowerCase("input.txt", "output.txt");
        }catch(Exception ex){


But this is what I need:
The program needs to read an input file and write it to an output file. In other words it should create an input file by typing one not by typing into the file from the program.

Avatar of undefined
Last Comment

8/22/2022 - Mon

It opens a txt document, changes the uppercase letters to lowercase, and saves to a new txt document. Can anyone assist?

Can you explain in some other words what you mean by this:
"create an input file by typing one not by typing into the file from the program."

What means "create an input file by typing one"?

Type a tex document, save it, and place it in a folder accessilble to the program. The program then points to that file, opensit, changes it to lowercase, and saves it as a text document in the same location.

I had to get clarity on this too.
Your help has saved me hundreds of hours of internet surfing.

You mean you want to re-write the file under the same name?
You don't want to read from file input.txt and write to output.txt, you rather want to
read form input.txt , transfer text which you read, to lower case and write it back to the same file input.txt overwriting
the original content - that is what you want?

No, file 1, named uppercase for example, gets opened and read by this program. The program processes the data, creates a new file, named lowercase for example, and sends it to the same location as the first.

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

In the folder C:\temp\test create file called uppercase.txt with this contents:


Open in new window

Run the above program and you'll see in the same folder the new file called
lowercase.txt will appear which will have the following two lines:


Open in new window

Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

And this will take an outside file, change the uppercase letters to lowercase, and create a new TXT file? Sorry to ask, but my computer is in my room, and this computer doesn't have Coderunner.

What you mean by "outside file" ?

Thanks again for_yan!
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes

The folder where the input file is located and where the output file will be written needs to be accessible
from the computer where you execute the program.
If that folder is on thedifferent computer then it needs to be mapped to the computer where you execute your program.

You are always welcome.