mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 10:54:57 +00:00

We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
23 lines
572 B
C++
23 lines
572 B
C++
/*
|
|
* Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include "Format.h"
|
|
#include <AK/DeprecatedString.h>
|
|
#include <AK/StringBuilder.h>
|
|
#include <AK/Vector.h>
|
|
|
|
namespace Diff {
|
|
DeprecatedString generate_only_additions(DeprecatedString const& text)
|
|
{
|
|
auto lines = text.split('\n', SplitBehavior::KeepEmpty);
|
|
StringBuilder builder;
|
|
builder.appendff("@@ -0,0 +1,{} @@\n", lines.size());
|
|
for (auto const& line : lines) {
|
|
builder.appendff("+{}\n", line);
|
|
}
|
|
return builder.to_string();
|
|
}
|
|
};
|