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