wxMaxima
Loading...
Searching...
No Matches
StringUtils.h
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2020 Kuba Ober <kuba@mareimbrium.org>
4//
5// Everyone is permitted to copy and distribute verbatim copies
6// of this licence document, but changing it is not allowed.
7//
8// WXWINDOWS LIBRARY LICENCE
9// TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
10//
11// This library is free software; you can redistribute it and/or modify it
12// under the terms of the GNU Library General Public Licence as published by
13// the Free Software Foundation; either version 2 of the Licence, or (at your
14// option) any later version.
15//
16// This library is distributed in the hope that it will be useful, but WITHOUT
17// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
19// Licence for more details.
20//
21// You should have received a copy of the GNU Library General Public Licence
22// along with this software, usually in a file named COPYING.LIB. If not,
23// write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
24// Floor, Boston, MA 02110-1301 USA.
25//
26// EXCEPTION NOTICE
27//
28// 1. As a special exception, the copyright holders of this library give
29// permission for additional uses of the text contained in this release of the
30// library as licenced under the wxWindows Library Licence, applying either
31// version 3.1 of the Licence, or (at your option) any later version of the
32// Licence as published by the copyright holders of version 3.1 of the Licence
33// document.
34//
35// 2. The exception is that you may use, copy, link, modify and distribute
36// under your own terms, binary object code versions of works based on the
37// Library.
38//
39// 3. If you copy code from files distributed under the terms of the GNU
40// General Public Licence or the GNU Library General Public Licence into a
41// copy of this library, as this licence permits, the exception does not apply
42// to the code that you add in this way. To avoid misleading anyone as to the
43// status of such modified files, you must delete this exception notice from
44// such code and/or adjust the licensing conditions notice accordingly.
45//
46// 4. If you write modifications of your own for this library, it is your
47// choice whether to permit this exception to apply to your modifications. If
48// you do not wish that, you must delete the exception notice from such code
49// and/or adjust the licensing conditions notice accordingly.
50//
51// SPDX-License-Identifier: wxWindows
52
53#ifndef WXMAXIMA_STRINGUTILS_H
54#define WXMAXIMA_STRINGUTILS_H
55
56#include <wx/string.h>
57#include <wx/translation.h>
58
59namespace wxm {
60
69 extern const wxString emptyString;
70
75#define S_(string) ([]()->const wxString &{ static const wxString str(wxS(string)); return str; }())
76
77// String Comparisons
78
80 bool StartsWithChar(const wxString &str, wxUniChar ch);
82 bool StartsWithChar(const wxString &str, wxStringCharType ch);
84 bool StartsWithChar(const wxString &str, char ch);
85
87 bool EndsWithChar(const wxString &str, wxUniChar ch);
89 bool EndsWithChar(const wxString &str, wxStringCharType ch);
91 bool EndsWithChar(const wxString &str, char ch);
92
93// String normalization
94
96 void NormalizeEOLsRemoveNULs(wxString &str);
97
98} // namespace wxm
99
100#endif