LibDiff: Convert StringBuilder::appendf() => AK::Format
This commit is contained in:
parent
f1c6288803
commit
5b87276841
Notes:
sideshowbarker
2024-07-18 18:35:35 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/5b87276841f
1 changed files with 2 additions and 3 deletions
|
@ -7,16 +7,15 @@
|
|||
#include "Format.h"
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
namespace Diff {
|
||||
String generate_only_additions(const String& text)
|
||||
{
|
||||
auto lines = text.split('\n', true); // Keep empty
|
||||
StringBuilder builder;
|
||||
builder.appendf("@@ -0,0 +1,%zu @@\n", lines.size());
|
||||
builder.appendff("@@ -0,0 +1,{} @@\n", lines.size());
|
||||
for (const auto& line : lines) {
|
||||
builder.appendf("+%s\n", line.characters());
|
||||
builder.appendff("+{}\n", line);
|
||||
}
|
||||
return builder.to_string();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue