38#include <fmt/chrono.h>
41#include <wx/tokenzr.h>
63 wxString filtered_fullpath = aFullFilename;
68 filtered_fullpath.Replace(
"/",
"_" );
69 filtered_fullpath.Replace(
"\\",
"_" );
72 if( filtered_fullpath.Length() > 1 && filtered_fullpath[1] ==
':' )
73 filtered_fullpath[1] =
' ';
76 if( wxString::npos != filtered_fullpath.find_first_of( wxFileName::GetForbiddenChars() ) )
86 bool inOverbar =
false;
89 if( aOldStr == wxT(
"~" ) )
92 newStr.reserve( aOldStr.length() );
94 for( wxString::const_iterator chIt = aOldStr.begin(); chIt != aOldStr.end(); ++chIt )
98 wxString::const_iterator lookahead = chIt + 1;
100 if( lookahead != aOldStr.end() && *lookahead ==
'~' )
102 if( ++lookahead != aOldStr.end() && *lookahead ==
'{' )
106 newStr << wxT(
"~~{}" );
111 newStr << wxT(
"~" );
115 else if( lookahead != aOldStr.end() && *lookahead ==
'{' )
125 newStr << wxT(
"}" );
130 newStr << wxT(
"~{" );
137 else if( ( *chIt ==
' ' || *chIt ==
'}' || *chIt ==
')' ) && inOverbar )
140 newStr << wxT(
"}" );
149 newStr << wxT(
"}" );
159 for( wxString::iterator ii = aString->begin(); ii != aString->end(); ++ii )
161 if( *ii ==
L'\u00B4' || *ii ==
L'\u2018' || *ii ==
L'\u2019' )
166 if( *ii ==
L'\u201C' || *ii ==
L'\u201D' )
171 if( *ii ==
L'\u2013' || *ii ==
L'\u2014' )
185 std::vector<bool> braceStack;
187 converted.reserve( aSource.length() );
189 for( wxUniChar c: aSource )
194 converted += wxT(
"{slash}" );
195 else if( c ==
'\n' || c ==
'\r' )
196 converted += wxEmptyString;
204 converted += wxT(
"{slash}" );
206 converted += wxT(
"{backslash}" );
208 converted += wxT(
"{lt}" );
210 converted += wxT(
"{gt}" );
212 converted += wxT(
"{colon}" );
214 converted += wxT(
"{dblquote}" );
215 else if( c ==
'\n' || c ==
'\r' )
216 converted += wxEmptyString;
223 converted += wxT(
"{slash}" );
225 converted += wxT(
"{comma}" );
227 converted += wxT(
"{dblquote}" );
234 converted += wxT(
"{dblquote}" );
240 if( c >= 0x7F || c ==
'\'' || c ==
'\\' || c ==
'(' || c ==
')' )
242 unsigned int code = c;
244 snprintf( buffer,
sizeof(buffer),
"\\u%4.4X", code );
254 if( c ==
'\n' || c ==
'\r' )
255 converted += wxT(
"{return}" );
262 converted += wxT(
"{slash}" );
264 converted += wxT(
"{backslash}" );
266 converted += wxT(
"{dblquote}" );
268 converted += wxT(
"{lt}" );
270 converted += wxT(
"{gt}" );
272 converted += wxT(
"{bar}" );
274 converted += wxT(
"{colon}" );
276 converted += wxT(
"{tab}" );
277 else if( c ==
'\n' || c ==
'\r' )
278 converted += wxT(
"{return}" );
285 converted += wxT(
"{space}" );
292 converted += wxT(
"{comma}" );
293 else if( c ==
'\n' || c ==
'\r' )
294 converted += wxT(
"{return}" );
310 size_t sourceLen = aSource.length();
319 newbuf.reserve( sourceLen );
324 for(
size_t i = 0; i < sourceLen; ++i )
333 bool terminated =
false;
335 for( i = i + 1; i < sourceLen; ++i )
359 else if( prev ==
'$' || prev ==
'~' || prev ==
'^' || prev ==
'_' )
363 else if( token == wxT(
"dblquote" ) ) newbuf << wxT(
"\"" );
364 else if( token == wxT(
"quote" ) ) newbuf << wxT(
"'" );
365 else if( token == wxT(
"lt" ) ) newbuf << wxT(
"<" );
366 else if( token == wxT(
"gt" ) ) newbuf << wxT(
">" );
367 else if( token == wxT(
"backslash" ) ) newbuf << wxT(
"\\" );
368 else if( token == wxT(
"slash" ) ) newbuf << wxT(
"/" );
369 else if( token == wxT(
"bar" ) ) newbuf << wxT(
"|" );
370 else if( token == wxT(
"comma" ) ) newbuf << wxT(
"," );
371 else if( token == wxT(
"colon" ) ) newbuf << wxT(
":" );
372 else if( token == wxT(
"space" ) ) newbuf << wxT(
" " );
373 else if( token == wxT(
"dollar" ) ) newbuf << wxT(
"$" );
374 else if( token == wxT(
"tab" ) ) newbuf << wxT(
"\t" );
375 else if( token == wxT(
"return" ) ) newbuf << wxT(
"\n" );
376 else if( token == wxT(
"brace" ) ) newbuf << wxT(
"{" );
399 result.reserve( aString.length() );
401 for(
const wxString& word : words )
406 result += word.Capitalize();
420 result.reserve( aString.length() );
422 for(
const wxString& word : words )
425 result += word.Capitalize();
427 result += wxT(
" " ) + word.Lower();
438 const char* start = aSource;
441 while( (cc = *aSource++) != 0 )
461 if( cc !=
'"' && cc !=
'\\' )
475 return aSource - start;
485 const char* start = aSource;
486 char* limit = aDest + aDestSize - 1;
489 while( ( cc = *aSource++ ) != 0 && aDest < limit )
508 if( cc !=
'"' && cc !=
'\\' )
523 return aSource - start;
529 wxString str = aString;
532 str.Replace( wxT(
"\r\n" ), wxT(
"\r" ) );
533 str.Replace( wxT(
"\n" ), wxT(
"\r" ) );
535 std::string utf8 =
TO_UTF8( aString );
539 ret.reserve( utf8.length() + 2 );
543 for( std::string::const_iterator it = utf8.begin(); it!=utf8.end(); ++it )
551 else if( *it ==
'\\' )
572 converted.reserve( aString.length() );
574 for( wxUniChar c : aString )
577 converted += wxT(
""" );
579 converted += wxT(
"'" );
581 converted += wxT(
"&" );
583 converted += wxT(
"<" );
585 converted += wxT(
">" );
597 static const std::map<wxString, wxString> c_replacements = {
598 { wxS(
"quot" ), wxS(
"\"" ) },
599 { wxS(
"apos" ), wxS(
"'" ) },
600 { wxS(
"amp" ), wxS(
"&" ) },
601 { wxS(
"lt" ), wxS(
"<" ) },
602 { wxS(
"gt" ), wxS(
">" ) }
607 wxString regexStr =
"&(#(\\d*)|#x([a-zA-Z0-9]{4})";
609 for(
auto& [key, value] : c_replacements )
610 regexStr <<
'|' << key;
614 wxRegEx regex( regexStr );
621 wxString str = aString;
623 while( regex.Matches( str ) )
625 std::vector<wxString> matches;
626 regex.GetMatch( &start, &len );
628 result << str.Left( start );
630 wxString code = regex.GetMatch( str, 1 );
631 wxString codeDec = regex.GetMatch( str, 2 );
632 wxString codeHex = regex.GetMatch( str, 3 );
634 if( !codeDec.IsEmpty() || !codeHex.IsEmpty() )
636 unsigned long codeVal = 0;
638 if( !codeDec.IsEmpty() )
639 codeDec.ToCULong( &codeVal );
640 else if( !codeHex.IsEmpty() )
641 codeHex.ToCULong( &codeVal, 16 );
644 result << wxUniChar( codeVal );
646 else if(
auto val =
get_opt( c_replacements, code ) )
651 str = str.Mid( start + len );
662 wxString str = aInput;
663 wxRegEx( wxS(
"<[^>]*>" ) ).ReplaceAll( &str, wxEmptyString );
671 static wxRegEx regex( wxS(
"\\b(https?|ftp|file)://([-\\w+&@#/%?=~|!:,.;]*[^.,:;<>\\(\\)\\s\u00b6])" ),
674 regex.ReplaceAll( &aStr,
"<a href=\"\\0\">\\0</a>" );
682 static wxRegEx regex( wxS(
"(https?|ftp|file)://([-\\w+&@#/%?=~|!:,.;]*[^.,:;<>\\s\u00b6])" ),
685 regex.ReplaceAll( &aStr,
"<a href=\"\\0\">\\0</a>" );
687 return regex.Matches( aStr );
693 wxString tmp = aString;
695 return tmp.Trim(
true ).Trim(
false ).IsEmpty();
702 int overbarDepth = -1;
703 int superSubDepth = -1;
704 int braceNesting = 0;
706 for(
auto chIt = aString.begin(),
end = aString.end(); chIt <
end; ++chIt )
714 else if( *chIt ==
'^' && superSubDepth == -1 )
716 auto lookahead = chIt;
718 if( ++lookahead !=
end && *lookahead ==
'{' )
721 superSubDepth = braceNesting;
726 else if( *chIt ==
'_' && superSubDepth == -1 )
728 auto lookahead = chIt;
730 if( ++lookahead !=
end && *lookahead ==
'{' )
733 superSubDepth = braceNesting;
738 else if( *chIt ==
'~' && overbarDepth == -1 )
740 auto lookahead = chIt;
742 if( ++lookahead !=
end && *lookahead ==
'{' )
745 overbarDepth = braceNesting;
750 else if( *chIt ==
'{' )
754 else if( *chIt ==
'}' )
756 if( braceNesting > 0 )
759 if( braceNesting == superSubDepth )
765 if( braceNesting == overbarDepth )
781 static const char whitespace[] =
" \t\n\r\f\v";
785 while( *
text && strchr( whitespace, *
text ) )
788 char* cp =
text + strlen(
text ) - 1;
790 while( cp >=
text && strchr( whitespace, *cp ) )
798char*
GetLine( FILE* File,
char* Line,
int* LineNum,
int SizeLine )
801 if( fgets( Line, SizeLine, File ) ==
nullptr )
807 }
while( Line[0] ==
'#' || Line[0] ==
'\n' || Line[0] ==
'\r' || Line[0] == 0 );
809 strtok( Line,
"\n\r" );
820#if defined(__MINGW32__) && !defined(_UCRT)
821 return fmt::format(
"{:%FT%T}", fmt::localtime( std::time(
nullptr ) ) );
823 return fmt::format(
"{:%FT%T%z}", fmt::localtime( std::time(
nullptr ) ) );
828int StrNumCmp(
const wxString& aString1,
const wxString& aString2,
bool aIgnoreCase )
830 int nb1 = 0, nb2 = 0;
832 auto str1 = aString1.begin();
833 auto str2 = aString2.begin();
835 while( str1 != aString1.end() && str2 != aString2.end() )
837 wxUniChar c1 = *str1;
838 wxUniChar c2 = *str2;
840 if( wxIsdigit( c1 ) && wxIsdigit( c2 ) )
848 nb1 = nb1 * 10 + (int) c1 -
'0';
850 }
while( str1 != aString1.end() && wxIsdigit( *str1 ) );
855 nb2 = nb2 * 10 + (int) c2 -
'0';
857 }
while( str2 != aString2.end() && wxIsdigit( *str2 ) );
865 c1 = ( str1 != aString1.end() ) ? *str1 : wxUniChar( 0 );
866 c2 = ( str2 != aString2.end() ) ? *str2 : wxUniChar( 0 );
874 wxUniChar uc1 = wxToupper( c1 );
875 wxUniChar uc2 = wxToupper( c2 );
878 return uc1 < uc2 ? -1 : 1;
890 if( str1 != aString1.end() )
893 if( str2 != aString2.end() )
897 if( str1 == aString1.end() && str2 != aString2.end() )
901 else if( str1 != aString1.end() && str2 == aString2.end() )
911 bool case_sensitive )
913 const wxChar* cp =
nullptr;
914 const wxChar* mp =
nullptr;
915 const wxChar* wild =
nullptr;
916 const wxChar* str =
nullptr;
917 wxString _pattern, _string_to_tst;
921 wild = pattern.GetData();
922 str = string_to_tst.GetData();
927 _pattern.MakeUpper();
928 _string_to_tst = string_to_tst;
929 _string_to_tst.MakeUpper();
930 wild = _pattern.GetData();
931 str = _string_to_tst.GetData();
934 while( ( *str ) && ( *wild !=
'*' ) )
936 if( ( *wild != *str ) && ( *wild !=
'?' ) )
953 else if( ( *wild == *str ) || ( *wild ==
'?' ) )
965 while( *wild ==
'*' )
977 static const wxString modifiers( wxT(
"pnuµμmkKM" ) );
979 if( !aString.length() )
985 if( modifiers.Find( aString[ 0 ] ) >= 0 )
987 modifier = aString[ 0 ];
988 units = aString.Mid( 1 ).Trim();
993 units = aString.Mid( 0 ).Trim();
997 && !units.IsSameAs( wxT(
"F" ),
false )
998 && !units.IsSameAs( wxT(
"hz" ),
false )
999 && !units.IsSameAs( wxT(
"W" ),
false )
1000 && !units.IsSameAs( wxT(
"V" ),
false )
1001 && !units.IsSameAs( wxT(
"A" ),
false )
1002 && !units.IsSameAs( wxT(
"H" ),
false ) )
1007 if( modifier ==
'p' )
1009 if( modifier ==
'n' )
1011 else if( modifier ==
'u' || modifier == wxS(
"µ" )[0] || modifier == wxS(
"μ" )[0] )
1013 else if( modifier ==
'm' )
1015 else if( modifier ==
'k' || modifier ==
'K' )
1017 else if( modifier ==
'M' )
1019 else if( modifier ==
'G' )
1039 value->Replace( wxS(
" " ), wxEmptyString );
1041 wxChar ambiguousSeparator =
'?';
1042 wxChar thousandsSeparator =
'?';
1043 bool thousandsSeparatorFound =
false;
1044 wxChar decimalSeparator =
'?';
1045 bool decimalSeparatorFound =
false;
1048 for(
int ii = (
int) value->length() - 1; ii >= 0; --ii )
1050 wxChar c = value->GetChar( ii );
1052 if( c >=
'0' && c <=
'9' )
1056 else if( c ==
'.' || c ==
',' )
1058 if( decimalSeparator !=
'?' || thousandsSeparator !=
'?' )
1062 if( c == decimalSeparator )
1064 if( thousandsSeparatorFound )
1066 else if( decimalSeparatorFound )
1069 decimalSeparatorFound =
true;
1071 else if( c == thousandsSeparator )
1076 thousandsSeparatorFound =
true;
1079 else if( ambiguousSeparator !=
'?' )
1083 if( c == ambiguousSeparator )
1086 thousandsSeparator = ambiguousSeparator;
1087 thousandsSeparatorFound =
true;
1088 decimalSeparator = c ==
'.' ?
',' :
'.';
1093 decimalSeparator = ambiguousSeparator;
1094 decimalSeparatorFound =
true;
1095 thousandsSeparator = c;
1096 thousandsSeparatorFound =
true;
1108 if( ( ii == 1 && value->GetChar( 0 ) ==
'0' ) || digits != 3 )
1110 decimalSeparator = c;
1111 decimalSeparatorFound =
true;
1112 thousandsSeparator = c ==
'.' ?
',' :
'.';
1116 ambiguousSeparator = c;
1129 if( decimalSeparator ==
'?' && thousandsSeparator ==
'?' )
1131 const struct lconv* lc = localeconv();
1133 decimalSeparator = lc->decimal_point[0];
1134 thousandsSeparator = decimalSeparator ==
'.' ?
',' :
'.';
1138 value->Replace( thousandsSeparator, wxEmptyString );
1139 value->Replace( decimalSeparator,
'.' );
1152 wxString strFWordBeg, strFWordMid, strFWordEnd;
1153 wxString strSWordBeg, strSWordMid, strSWordEnd;
1156 SplitString( fWord, &strFWordBeg, &strFWordMid, &strFWordEnd );
1157 SplitString( sWord, &strSWordBeg, &strSWordMid, &strSWordEnd );
1160 int isEqual = strFWordBeg.CmpNoCase( strSWordBeg );
1166 else if( isEqual < 0 )
1173 double lFirstNumber = 0;
1174 double lSecondNumber = 0;
1175 bool endingIsModifier =
false;
1180 strFWordMid.ToCDouble( &lFirstNumber );
1181 strSWordMid.ToCDouble( &lSecondNumber );
1183 endingIsModifier |=
ApplyModifier( lFirstNumber, strFWordEnd );
1184 endingIsModifier |=
ApplyModifier( lSecondNumber, strSWordEnd );
1186 if( lFirstNumber > lSecondNumber )
1188 else if( lFirstNumber < lSecondNumber )
1191 else if( !endingIsModifier )
1192 return strFWordEnd.CmpNoCase( strSWordEnd );
1201 wxString* strBeginning,
1202 wxString* strDigits,
1205 static const wxString separators( wxT(
".," ) );
1208 strBeginning->Empty();
1213 if( strToSplit.length() == 0 )
1219 for( ii = (strToSplit.length() - 1); ii >= 0; ii-- )
1221 if( wxIsdigit( strToSplit[ii] ) )
1228 *strBeginning = strToSplit;
1233 *strEnd = strToSplit.substr( ii + 1 );
1236 int position = ii + 1;
1238 for( ; ii >= 0; ii-- )
1240 if( !wxIsdigit( strToSplit[ii] ) && separators.Find( strToSplit[ii] ) < 0 )
1246 *strDigits = strToSplit.substr( 0, position );
1252 *strDigits = strToSplit.substr( ii + 1, position - ii - 1 );
1253 *strBeginning = strToSplit.substr( 0, ii + 1 );
1267 int index = aStr.Len() - 1;
1271 const char chr = aStr.GetChar( index );
1273 if( chr <
'0' || chr >
'9' )
1276 number += ( chr -
'0' ) * base;
1293 bool changed =
false;
1295 result.reserve( aName->length() );
1297 for( std::string::iterator it = aName->begin(); it != aName->end(); ++it )
1315 *aName = std::move(
result );
1323 bool changed =
false;
1325 result.reserve( aName.Length() );
1328 for( wxString::iterator it = aName.begin(); it != aName.end(); ++it )
1330 if( illWChars.Find( *it ) != wxNOT_FOUND )
1335 result += wxString::Format(
"%%%02x", *it );
1346 aName = std::move(
result );
1352void wxStringSplit(
const wxString& aText, wxArrayString& aStrings, wxChar aSplitter )
1356 for(
unsigned ii = 0; ii < aText.Length(); ii++ )
1358 if( aText[ii] == aSplitter )
1360 aStrings.Add( tmp );
1369 if( !tmp.IsEmpty() )
1370 aStrings.Add( tmp );
1376 struct lconv* lc = localeconv();
1377 char sep = lc->decimal_point[0];
1378 unsigned sep_pos = aStringValue.Find( sep );
1383 unsigned min_len = sep_pos + aTrailingZeroAllowed + 1;
1385 while( aStringValue.Len() > min_len )
1387 if( aStringValue.Last() ==
'0' )
1388 aStringValue.RemoveLast();
1400 if( aValue != 0.0 && std::fabs( aValue ) <= 0.0001 )
1402 buf = fmt::format(
"{:.16f}", aValue );
1405 while( !buf.empty() && buf[buf.size() - 1] ==
'0' )
1412 if( buf[buf.size() - 1] ==
'.' )
1419 buf = fmt::format(
"{:.10g}", aValue );
1431 if( aValue != 0.0 && std::fabs( aValue ) <= 0.0001 )
1435 len = snprintf( buf,
sizeof( buf ),
"%.16f", aValue );
1437 while( --len > 0 && buf[len] ==
'0' )
1440 if( buf[len] ==
'.' || buf[len] ==
',' )
1449 len = snprintf( buf,
sizeof( buf ),
"%.10g", aValue );
1452 return std::string( buf, len );
1459 wxString line = wxString::FromUTF8( cstring );
1461 if( line.IsEmpty() )
1463 line = wxConvCurrent->cMB2WC( cstring );
1465 if( line.IsEmpty() )
1466 line = wxString::From8BitData( cstring );
1476 wxString line = wxString::FromUTF8( aString );
1478 if( line.IsEmpty() )
1480 line = wxConvCurrent->cMB2WC( aString.c_str() );
1482 if( line.IsEmpty() )
1483 line = wxString::From8BitData( aString.c_str() );
1492 wxString uriPathAndFileName;
1494 wxCHECK( aFileUri.StartsWith( wxS(
"file://" ), &uriPathAndFileName ), aFileUri );
1496 wxString tmp = uriPathAndFileName;
1497 wxString retv = wxS(
"file://" );
1499 tmp.Replace( wxS(
"\\" ), wxS(
"/" ) );
1500 tmp.Replace( wxS(
":" ), wxS(
"" ) );
1502 if( !tmp.IsEmpty() && tmp[0] !=
'/' )
1503 tmp = wxS(
"/" ) + tmp;
1514 std::pair<wxString, long> ParseAlphaNumericPin(
const wxString& pinNum )
1519 size_t numStart = pinNum.length();
1520 for(
int i =
static_cast<int>( pinNum.length() ) - 1; i >= 0; --i )
1522 if( !wxIsdigit( pinNum[i] ) )
1531 if( numStart < pinNum.length() )
1533 prefix = pinNum.Left( numStart );
1534 wxString numericPart = pinNum.Mid( numStart );
1535 numericPart.ToLong( &numValue );
1538 return { prefix, numValue };
1547 std::vector<wxString> expanded;
1549 const bool hasOpenBracket = aPinName.Contains( wxT(
"[" ) );
1550 const bool hasCloseBracket = aPinName.Contains( wxT(
"]" ) );
1552 if( hasOpenBracket || hasCloseBracket )
1554 if( !aPinName.StartsWith( wxT(
"[" ) ) || !aPinName.EndsWith( wxT(
"]" ) ) )
1558 expanded.push_back( aPinName );
1563 if( !aPinName.StartsWith( wxT(
"[" ) ) || !aPinName.EndsWith( wxT(
"]" ) ) )
1565 expanded.push_back( aPinName );
1569 const wxString inner = aPinName.Mid( 1, aPinName.Length() - 2 );
1572 while( start < inner.length() )
1574 size_t comma = inner.find(
',', start );
1575 wxString part = ( comma == wxString::npos ) ? inner.Mid( start ) : inner.Mid( start, comma - start );
1576 part.Trim(
true ).Trim(
false );
1579 start = ( comma == wxString::npos ) ? inner.length() : comma + 1;
1583 int dashPos = part.Find(
'-' );
1584 if( dashPos != wxNOT_FOUND )
1586 wxString startTxt = part.Left( dashPos );
1587 wxString endTxt = part.Mid( dashPos + 1 );
1588 startTxt.Trim(
true ).Trim(
false );
1589 endTxt.Trim(
true ).Trim(
false );
1591 auto [startPrefix, startVal] = ParseAlphaNumericPin( startTxt );
1592 auto [endPrefix, endVal] = ParseAlphaNumericPin( endTxt );
1594 if( startPrefix != endPrefix || startVal == -1 || endVal == -1 || startVal > endVal )
1599 expanded.push_back( aPinName );
1603 for(
long ii = startVal; ii <= endVal; ++ii )
1605 if( startPrefix.IsEmpty() )
1606 expanded.emplace_back( wxString::Format( wxT(
"%ld" ), ii ) );
1608 expanded.emplace_back( wxString::Format( wxT(
"%s%ld" ), startPrefix, ii ) );
1613 expanded.push_back( part );
1616 if( comma == wxString::npos )
1621 if( expanded.empty() )
1623 expanded.push_back( aPinName );
This file contains miscellaneous commonly used macros and functions.
std::optional< V > get_opt(const std::map< wxString, V > &aMap, const wxString &aKey)
int StrPrintf(std::string *result, const char *format,...)
This is like sprintf() but the output is appended to a std::string instead of to a character array.
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
wxString RemoveHTMLTags(const wxString &aInput)
Removes HTML tags from a string.
wxString EscapeHTML(const wxString &aString)
Return a new wxString escaped for embedding in HTML.
bool WildCompareString(const wxString &pattern, const wxString &string_to_tst, bool case_sensitive)
Compare a string against wild card (* and ?) pattern using the usual rules.
wxString GetDefaultVariantName()
std::vector< wxString > ExpandStackedPinNotation(const wxString &aPinName, bool *aValid)
Expand stacked pin notation like [1,2,3], [1-4], [A1-A4], or [AA1-AA3,AB4,CD12-CD14] into individual ...
wxString ConvertToNewOverbarNotation(const wxString &aOldStr)
Convert the old ~...~ overbar notation to the new ~{...} one.
int GetTrailingInt(const wxString &aStr)
Gets the trailing int, if any, from a string.
wxString UnescapeString(const wxString &aSource)
static const char illegalFileNameChars[]
Illegal file name characters used to ensure file names will be valid on all supported platforms.
wxString LinkifyHTML(wxString aStr)
Wraps links in HTML tags.
bool convertSeparators(wxString *value)
wxString GetIllegalFileNameWxChars()
wxString From_UTF8(const char *cstring)
int SortVariantNames(const wxString &aLhs, const wxString &aRhs)
bool ConvertSmartQuotesAndDashes(wxString *aString)
Convert curly quotes and em/en dashes to straight quotes and dashes.
static const wxChar defaultVariantName[]
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
int ReadDelimitedText(wxString *aDest, const char *aSource)
Copy bytes from aSource delimited string segment to aDest wxString.
bool ReplaceIllegalFileNameChars(std::string *aName, int aReplaceChar)
Checks aName for illegal file name characters.
wxString TitleCaps(const wxString &aString)
Capitalize the first letter in each word.
std::string UIDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 We want to avoid scientific ...
std::string FormatDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 This function is intended in...
int PrintableCharCount(const wxString &aString)
Return the number of printable (ie: non-formatting) chars.
std::string EscapedUTF8(const wxString &aString)
Return an 8 bit UTF8 string given aString in Unicode form.
char * GetLine(FILE *File, char *Line, int *LineNum, int SizeLine)
Read one line line from aFile.
bool ApplyModifier(double &value, const wxString &aString)
wxString InitialCaps(const wxString &aString)
Capitalize only the first word.
wxString NormalizeFileUri(const wxString &aFileUri)
Normalize file path aFileUri to URI convention.
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
wxString GetISO8601CurrentDateTime()
int ValueStringCompare(const wxString &strFWord, const wxString &strSWord)
Compare strings like the strcmp function but handle numbers and modifiers within the string text corr...
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.
bool IsFullFileNameValid(const wxString &aFullFilename)
Checks if a full filename is valid, i.e.
void StripTrailingZeros(wxString &aStringValue, unsigned aTrailingZeroAllowed)
Remove trailing zeros from a string containing a converted float number.
char * StrPurge(char *text)
Remove leading and training spaces, tabs and end of line chars in text.
bool NoPrintableChars(const wxString &aString)
Return true if the string is empty or contains only whitespace.
wxString UnescapeHTML(const wxString &aString)
Return a new wxString unescaped from HTML format.
bool IsURL(wxString aStr)
Performs a URL sniff-test on a string.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
ESCAPE_CONTEXT
Escape/Unescape routines to safely encode reserved-characters in various contexts.
wxString result
Test unit parsing edge cases and error handling.