diff options
author | Andreas Kling <kling@serenityos.org> | 2021-05-24 11:50:46 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-24 11:59:18 +0200 |
commit | de395a3df236eb653db78b5b88a0178036f99ba0 (patch) | |
tree | 2a6bd2f6126aa62650fc92092eaa4d88ebebc19e /Userland/Libraries/LibDiff/Hunks.cpp | |
parent | 875a2cbb7150b036af343364a8bf2d07a97dd03d (diff) | |
download | serenity-de395a3df236eb653db78b5b88a0178036f99ba0.zip |
AK+Everywhere: Consolidate String::index_of() and String::find()
We had two functions for doing mostly the same thing. Combine both
of them into String::find() and use that everywhere.
Also add some tests to cover basic behavior.
Diffstat (limited to 'Userland/Libraries/LibDiff/Hunks.cpp')
-rw-r--r-- | Userland/Libraries/LibDiff/Hunks.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibDiff/Hunks.cpp b/Userland/Libraries/LibDiff/Hunks.cpp index 9887693d61..6870dda028 100644 --- a/Userland/Libraries/LibDiff/Hunks.cpp +++ b/Userland/Libraries/LibDiff/Hunks.cpp @@ -82,7 +82,7 @@ HunkLocation parse_hunk_location(const String& location_line) size_t length { 0 }; }; auto parse_start_and_length_pair = [](const String& raw) { - auto index_of_separator = raw.index_of(",").value(); + auto index_of_separator = raw.find(',').value(); auto start = raw.substring(0, index_of_separator); auto length = raw.substring(index_of_separator + 1, raw.length() - index_of_separator - 1); auto res = StartAndLength { start.to_uint().value() - 1, length.to_uint().value() - 1 }; |