File indexing completed on 2023-12-03 04:55:08
0001 /* 0002 SPDX-FileCopyrightText: 2023 Julius Künzel <jk.kdedev@smartlab.uber.space> 0003 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 */ 0005 0006 #pragma once 0007 0008 #include <QString> 0009 #include <QStringList> 0010 0011 class QStringUtils 0012 { 0013 public: 0014 /** @returns a name based on @param name that is unique in @param names. 0015 * This is achived by adding a number as suffix to the @param name in case name 0016 * does already exist in @param names. 0017 */ 0018 static QString getUniqueName(const QStringList &names, const QString &name); 0019 /** Append @param appendix to @param filename before the file extension. 0020 * The part of the string after the last dot will be treated as file extension. 0021 * Hence it does not work with extensions like .tar.gz 0022 */ 0023 static QString appendToFilename(const QString &filename, const QString &appendix); 0024 };