diff options
| author | Jacob McDonnell <jacob@simplelittledream.com> | 2022-01-14 18:06:29 -0500 |
|---|---|---|
| committer | Jacob McDonnell <jacob@simplelittledream.com> | 2022-01-14 18:06:29 -0500 |
| commit | 03ce423e9d74afc116f02f452e11bb82354b7f66 (patch) | |
| tree | fe46cd51aa54990be2442e2581ced19308662bd4 /src/filebuffer.java | |
| parent | 9927436cc355eb09675bcd6dd026a984c6ba9309 (diff) | |
Added next, previous, last, and current line commandsmaster
Diffstat (limited to 'src/filebuffer.java')
| -rw-r--r-- | src/filebuffer.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/filebuffer.java b/src/filebuffer.java index ff6b225..44515a1 100644 --- a/src/filebuffer.java +++ b/src/filebuffer.java @@ -19,6 +19,39 @@ public class filebuffer { readFile(); } } + + /* upperCase: makes the current line upper case */ + public void upperCase() { + String temp = buffer.get(currentLine).toUpperCase(); + buffer.add(currentLine, temp); + buffer.remove(currentLine + 1); + } + + /* lowerCase: makes the current line lower case */ + public void lowerCase() { + String temp = buffer.get(currentLine).toLowerCase(); + buffer.add(currentLine, temp); + buffer.remove(currentLine + 1); + } + + /* upperCase: makes the lines in the range upper case */ + public void upperCase(int start, int stop) { + for (int i = start; i < stop; i++) { + String temp = buffer.get(i).toUpperCase(); + buffer.add(i, temp); + buffer.remove(i + 1); + } + } + + /* lowerCase: makes the lines in the range lower case */ + public void lowerCase(int start, int stop) { + for (int i = start; i < stop; i++) { + String temp = buffer.get(i).toLowerCase(); + buffer.add(i, temp); + buffer.remove(i + 1); + } + } + /* getFileSize: gets the size of the buffer arraylist */ public int getFileSize() { return buffer.size(); @@ -121,6 +154,10 @@ public class filebuffer { replace(start, stop, temp[1], temp[2]); else if (temp[0].equals("d")) deleteLine(start, stop); + else if (temp[0].equals("l")) + lowerCase(start, stop); + else if (temp[0].equals("U")) + upperCase(start, stop); } /* deleteLine: deletes line in the range of start to stop */ |
