32#include <wx/filename.h>
162KICOMMON_API char*
GetLine( FILE* aFile,
char* Line,
int* LineNum =
nullptr,
int SizeLine = 255 );
202 bool aIgnoreCase =
false );
218 std::sort( aList.begin(), aList.end(),
219 [aCaseSensitivity](
const wxString& lhs,
const wxString& rhs )
221 return StrNumCmp( lhs, rhs, aCaseSensitivity == CASE_SENSITIVITY::INSENSITIVE ) < 0;
232 const wxString& string_to_tst,
233 bool case_sensitive =
true );
251 wxString* strBeginning,
300 bool operator() (
const wxString& strA,
const wxString& strB )
const
302 wxString::const_reverse_iterator sA = strA.rbegin();
303 wxString::const_reverse_iterator eA = strA.rend();
305 wxString::const_reverse_iterator sB = strB.rbegin();
306 wxString::const_reverse_iterator eB = strB.rend();
320 while( sA != eA && sB != eB )
322 if( ( *sA ) == ( *sB ) )
329 if( ( *sA ) < ( *sB ) )
351static inline std::vector<std::string>
split(
const std::string& aStr,
const std::string& aDelim )
357 std::vector<std::string> tokens;
359 while( pos < aStr.size() )
361 pos = aStr.find_first_of( aDelim, last_pos );
363 if( pos == std::string::npos )
366 len = pos - last_pos;
368 tokens.push_back( aStr.substr( last_pos, len ) );
379 if( !aDesc.IsEmpty() )
380 aDesc << wxT(
", " );
393 for(
const auto& item : aItemCollection )
453#define TO_UTF8( wxstring ) ( (const char*) ( wxstring ).utf8_str() )
495 bool* aValid =
nullptr );
KICOMMON_API bool WildCompareString(const wxString &pattern, const wxString &string_to_tst, bool case_sensitive=true)
Compare a string against wild card (* and ?) pattern using the usual rules.
KICOMMON_API wxString PrettyPrintForMenu(const wxString &aString)
Remove markup (such as overbar or subscript) that we can't render to menu items.
KICOMMON_API std::vector< wxString > ExpandStackedPinNotation(const wxString &aPinName, bool *aValid=nullptr)
Expand stacked pin notation like [1,2,3], [1-4], [A1-A4], or [AA1-AA3,AB4,CD12-CD14] into individual ...
KICOMMON_API wxString InitialCaps(const wxString &aString)
Capitalize only the first word.
KICOMMON_API bool IsFullFileNameValid(const wxString &aFullFilename)
Checks if a full filename is valid, i.e.
KICOMMON_API std::string UIDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 We want to avoid scientific ...
KICOMMON_API wxString From_UTF8(const std::string &aString)
Convert an expected UTF8 encoded std::string to a wxString.
KICOMMON_API wxString TitleCaps(const wxString &aString)
Capitalize the first letter in each word.
KICOMMON_API bool ConvertSmartQuotesAndDashes(wxString *aString)
Convert curly quotes and em/en dashes to straight quotes and dashes.
KICOMMON_API void StripTrailingZeros(wxString &aStringValue, unsigned aTrailingZeroAllowed=1)
Remove trailing zeros from a string containing a converted float number.
KICOMMON_API wxString GetIllegalFileNameWxChars()
KICOMMON_API wxString NormalizeFileUri(const wxString &aFileUri)
Normalize file path aFileUri to URI convention.
void StrNumSort(T &aList, CASE_SENSITIVITY aCaseSensitivity)
Sort a container of wxString objects, in place, using the StrNumCmp() function.
KICOMMON_API int SplitString(const wxString &strToSplit, wxString *strBeginning, wxString *strDigits, wxString *strEnd)
Break a string into three parts: he alphabetic preamble, the numeric part, and any alphabetic ending.
KICOMMON_API wxString RemoveHTMLTags(const wxString &aInput)
Removes HTML tags from a string.
KICOMMON_API wxString GetISO8601CurrentDateTime()
KICOMMON_API int ReadDelimitedText(char *aDest, const char *aSource, int aDestSize)
Copy bytes from aSource delimited string segment to aDest buffer.
ESCAPE_CONTEXT
Escape/Unescape routines to safely encode reserved-characters in various contexts.
KICOMMON_API std::string EscapedUTF8(const wxString &aString)
Return an 8 bit UTF8 string given aString in Unicode form.
KICOMMON_API int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase=false)
Compare two strings with alphanumerical content.
KICOMMON_API wxString UnescapeString(const wxString &aSource)
static std::vector< std::string > split(const std::string &aStr, const std::string &aDelim)
Split the input string into a vector of output strings.
KICOMMON_API wxString ConvertToNewOverbarNotation(const wxString &aOldStr)
Convert the old ~...~ overbar notation to the new ~{...} one.
KICOMMON_API void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
KICOMMON_API bool IsURL(wxString aStr)
Performs a URL sniff-test on a string.
KICOMMON_API wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
KICOMMON_API char * GetLine(FILE *aFile, char *Line, int *LineNum=nullptr, int SizeLine=255)
Read one line line from aFile.
KICOMMON_API int GetTrailingInt(const wxString &aStr)
Gets the trailing int, if any, from a string.
KICOMMON_API wxString EscapeHTML(const wxString &aString)
Return a new wxString escaped for embedding in HTML.
void ConvertMarkdown2Html(const wxString &aMarkdownInput, wxString &aHtmlOutput)
KICOMMON_API wxString LinkifyHTML(wxString aStr)
Wraps links in HTML tags.
void AccumulateDescription(wxString &aDesc, const wxString &aItem)
Utility to build comma separated lists in messages.
KICOMMON_API int PrintableCharCount(const wxString &aString)
Return the number of printable (ie: non-formatting) chars.
KICOMMON_API bool NoPrintableChars(const wxString &aString)
Return true if the string is empty or contains only whitespace.
KICOMMON_API std::string FormatDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 This function is intended in...
KICOMMON_API bool ReplaceIllegalFileNameChars(std::string *aName, int aReplaceChar=0)
Checks aName for illegal file name characters.
KICOMMON_API wxString UnescapeHTML(const wxString &aString)
Return a new wxString unescaped from HTML format.
KICOMMON_API int ValueStringCompare(const wxString &strFWord, const wxString &strSWord)
Compare strings like the strcmp function but handle numbers and modifiers within the string text corr...
void AccumulateDescriptions(wxString &aDesc, const T &aItemCollection)
Build a comma-separated list from a collection of wxStrings.
KICOMMON_API char * StrPurge(char *text)
Remove leading and training spaces, tabs and end of line chars in text.
A helper for sorting strings from the rear.
bool operator()(const wxString &strA, const wxString &strB) const