38#include <fmt/chrono.h>
41#include <wx/tokenzr.h>
61 wxString filtered_fullpath = aFullFilename;
66 filtered_fullpath.Replace(
"/",
"_" );
67 filtered_fullpath.Replace(
"\\",
"_" );
70 if( filtered_fullpath.Length() > 1 && filtered_fullpath[1] ==
':' )
71 filtered_fullpath[1] =
' ';
74 if( wxString::npos != filtered_fullpath.find_first_of( wxFileName::GetForbiddenChars() ) )
84 bool inOverbar =
false;
87 if( aOldStr == wxT(
"~" ) )
90 newStr.reserve( aOldStr.length() );
92 for( wxString::const_iterator chIt = aOldStr.begin(); chIt != aOldStr.end(); ++chIt )
96 wxString::const_iterator lookahead = chIt + 1;
98 if( lookahead != aOldStr.end() && *lookahead ==
'~' )
100 if( ++lookahead != aOldStr.end() && *lookahead ==
'{' )
104 newStr << wxT(
"~~{}" );
109 newStr << wxT(
"~" );
113 else if( lookahead != aOldStr.end() && *lookahead ==
'{' )
123 newStr << wxT(
"}" );
128 newStr << wxT(
"~{" );
135 else if( ( *chIt ==
' ' || *chIt ==
'}' || *chIt ==
')' ) && inOverbar )
138 newStr << wxT(
"}" );
147 newStr << wxT(
"}" );
157 for( wxString::iterator ii = aString->begin(); ii != aString->end(); ++ii )
159 if( *ii == L
'\u00B4' || *ii == L
'\u2018' || *ii == L
'\u2019' )
164 if( *ii == L
'\u201C' || *ii == L
'\u201D' )
169 if( *ii == L
'\u2013' || *ii == L
'\u2014' )
183 std::vector<bool> braceStack;
185 converted.reserve( aSource.length() );
187 for( wxUniChar c: aSource )
192 converted += wxT(
"{slash}" );
193 else if( c ==
'\n' || c ==
'\r' )
194 converted += wxEmptyString;
202 converted += wxT(
"{slash}" );
204 converted += wxT(
"{backslash}" );
206 converted += wxT(
"{lt}" );
208 converted += wxT(
"{gt}" );
210 converted += wxT(
"{colon}" );
212 converted += wxT(
"{dblquote}" );
213 else if( c ==
'\n' || c ==
'\r' )
214 converted += wxEmptyString;
221 converted += wxT(
"{slash}" );
223 converted += wxT(
"{comma}" );
225 converted += wxT(
"{dblquote}" );
232 converted += wxT(
"{dblquote}" );
238 if( c >= 0x7F || c ==
'\'' || c ==
'\\' || c ==
'(' || c ==
')' )
240 unsigned int code = c;
242 snprintf( buffer,
sizeof(buffer),
"\\u%4.4X", code );
252 if( c ==
'\n' || c ==
'\r' )
253 converted += wxT(
"{return}" );
260 converted += wxT(
"{slash}" );
262 converted += wxT(
"{backslash}" );
264 converted += wxT(
"{dblquote}" );
266 converted += wxT(
"{lt}" );
268 converted += wxT(
"{gt}" );
270 converted += wxT(
"{bar}" );
272 converted += wxT(
"{colon}" );
274 converted += wxT(
"{tab}" );
275 else if( c ==
'\n' || c ==
'\r' )
276 converted += wxT(
"{return}" );
283 converted += wxT(
"{space}" );
290 converted += wxT(
"{comma}" );
291 else if( c ==
'\n' || c ==
'\r' )
292 converted += wxT(
"{return}" );
308 size_t sourceLen = aSource.length();
317 newbuf.reserve( sourceLen );
322 for(
size_t i = 0; i < sourceLen; ++i )
331 bool terminated =
false;
333 for( i = i + 1; i < sourceLen; ++i )
357 else if( prev ==
'$' || prev ==
'~' || prev ==
'^' || prev ==
'_' )
361 else if( token == wxT(
"dblquote" ) ) newbuf << wxT(
"\"" );
362 else if( token == wxT(
"quote" ) ) newbuf << wxT(
"'" );
363 else if( token == wxT(
"lt" ) ) newbuf << wxT(
"<" );
364 else if( token == wxT(
"gt" ) ) newbuf << wxT(
">" );
365 else if( token == wxT(
"backslash" ) ) newbuf << wxT(
"\\" );
366 else if( token == wxT(
"slash" ) ) newbuf << wxT(
"/" );
367 else if( token == wxT(
"bar" ) ) newbuf << wxT(
"|" );
368 else if( token == wxT(
"comma" ) ) newbuf << wxT(
"," );
369 else if( token == wxT(
"colon" ) ) newbuf << wxT(
":" );
370 else if( token == wxT(
"space" ) ) newbuf << wxT(
" " );
371 else if( token == wxT(
"dollar" ) ) newbuf << wxT(
"$" );
372 else if( token == wxT(
"tab" ) ) newbuf << wxT(
"\t" );
373 else if( token == wxT(
"return" ) ) newbuf << wxT(
"\n" );
374 else if( token == wxT(
"brace" ) ) newbuf << wxT(
"{" );
397 result.reserve( aString.length() );
399 for(
const wxString& word : words )
404 result += word.Capitalize();
418 result.reserve( aString.length() );
420 for(
const wxString& word : words )
423 result += word.Capitalize();
425 result += wxT(
" " ) + word.Lower();
436 const char* start = aSource;
439 while( (cc = *aSource++) != 0 )
459 if( cc !=
'"' && cc !=
'\\' )
473 return aSource - start;
483 const char* start = aSource;
484 char* limit = aDest + aDestSize - 1;
487 while( ( cc = *aSource++ ) != 0 && aDest < limit )
506 if( cc !=
'"' && cc !=
'\\' )
521 return aSource - start;
527 wxString str = aString;
530 str.Replace( wxT(
"\r\n" ), wxT(
"\r" ) );
531 str.Replace( wxT(
"\n" ), wxT(
"\r" ) );
533 std::string utf8 =
TO_UTF8( aString );
537 ret.reserve( utf8.length() + 2 );
541 for( std::string::const_iterator it = utf8.begin(); it!=utf8.end(); ++it )
549 else if( *it ==
'\\' )
570 converted.reserve( aString.length() );
572 for( wxUniChar c : aString )
575 converted += wxT(
""" );
577 converted += wxT(
"'" );
579 converted += wxT(
"&" );
581 converted += wxT(
"<" );
583 converted += wxT(
">" );
595 static const std::map<wxString, wxString> c_replacements = {
596 { wxS(
"quot" ), wxS(
"\"" ) },
597 { wxS(
"apos" ), wxS(
"'" ) },
598 { wxS(
"amp" ), wxS(
"&" ) },
599 { wxS(
"lt" ), wxS(
"<" ) },
600 { wxS(
"gt" ), wxS(
">" ) }
605 wxString regexStr =
"&(#(\\d*)|#x([a-zA-Z0-9]{4})";
607 for(
auto& [key, value] : c_replacements )
608 regexStr <<
'|' << key;
612 wxRegEx regex( regexStr );
619 wxString str = aString;
621 while( regex.Matches( str ) )
623 std::vector<wxString> matches;
624 regex.GetMatch( &start, &len );
626 result << str.Left( start );
628 wxString code = regex.GetMatch( str, 1 );
629 wxString codeDec = regex.GetMatch( str, 2 );
630 wxString codeHex = regex.GetMatch( str, 3 );
632 if( !codeDec.IsEmpty() || !codeHex.IsEmpty() )
634 unsigned long codeVal = 0;
636 if( !codeDec.IsEmpty() )
637 codeDec.ToCULong( &codeVal );
638 else if( !codeHex.IsEmpty() )
639 codeHex.ToCULong( &codeVal, 16 );
642 result << wxUniChar( codeVal );
644 else if(
auto val =
get_opt( c_replacements, code ) )
649 str = str.Mid( start + len );
660 wxString str = aInput;
661 wxRegEx( wxS(
"<[^>]*>" ) ).ReplaceAll( &str, wxEmptyString );
669 static wxRegEx regex( wxS(
"\\b(https?|ftp|file)://([-\\w+&@#/%?=~|!:,.;]*[^.,:;<>\\(\\)\\s\u00b6])" ),
672 regex.ReplaceAll( &aStr,
"<a href=\"\\0\">\\0</a>" );
680 static wxRegEx regex( wxS(
"(https?|ftp|file)://([-\\w+&@#/%?=~|!:,.;]*[^.,:;<>\\s\u00b6])" ),
683 regex.ReplaceAll( &aStr,
"<a href=\"\\0\">\\0</a>" );
685 return regex.Matches( aStr );
691 wxString tmp = aString;
693 return tmp.Trim(
true ).Trim(
false ).IsEmpty();
700 int overbarDepth = -1;
701 int superSubDepth = -1;
702 int braceNesting = 0;
704 for(
auto chIt = aString.begin(),
end = aString.end(); chIt <
end; ++chIt )
712 else if( *chIt ==
'^' && superSubDepth == -1 )
714 auto lookahead = chIt;
716 if( ++lookahead !=
end && *lookahead ==
'{' )
719 superSubDepth = braceNesting;
724 else if( *chIt ==
'_' && superSubDepth == -1 )
726 auto lookahead = chIt;
728 if( ++lookahead !=
end && *lookahead ==
'{' )
731 superSubDepth = braceNesting;
736 else if( *chIt ==
'~' && overbarDepth == -1 )
738 auto lookahead = chIt;
740 if( ++lookahead !=
end && *lookahead ==
'{' )
743 overbarDepth = braceNesting;
748 else if( *chIt ==
'{' )
752 else if( *chIt ==
'}' )
754 if( braceNesting > 0 )
757 if( braceNesting == superSubDepth )
763 if( braceNesting == overbarDepth )
779 static const char whitespace[] =
" \t\n\r\f\v";
783 while( *
text && strchr( whitespace, *
text ) )
786 char* cp =
text + strlen(
text ) - 1;
788 while( cp >=
text && strchr( whitespace, *cp ) )
796char*
GetLine( FILE* File,
char* Line,
int* LineNum,
int SizeLine )
799 if( fgets( Line, SizeLine, File ) ==
nullptr )
805 }
while( Line[0] ==
'#' || Line[0] ==
'\n' || Line[0] ==
'\r' || Line[0] == 0 );
807 strtok( Line,
"\n\r" );
818#if defined(__MINGW32__) && !defined(_UCRT)
819 return fmt::format(
"{:%FT%T}", fmt::localtime( std::time(
nullptr ) ) );
821 return fmt::format(
"{:%FT%T%z}", fmt::localtime( std::time(
nullptr ) ) );
826int StrNumCmp(
const wxString& aString1,
const wxString& aString2,
bool aIgnoreCase )
828 int nb1 = 0, nb2 = 0;
830 auto str1 = aString1.begin();
831 auto str2 = aString2.begin();
833 while( str1 != aString1.end() && str2 != aString2.end() )
835 wxUniChar c1 = *str1;
836 wxUniChar c2 = *str2;
838 if( wxIsdigit( c1 ) && wxIsdigit( c2 ) )
846 nb1 = nb1 * 10 + (int) c1 -
'0';
848 }
while( str1 != aString1.end() && wxIsdigit( *str1 ) );
853 nb2 = nb2 * 10 + (int) c2 -
'0';
855 }
while( str2 != aString2.end() && wxIsdigit( *str2 ) );
863 c1 = ( str1 != aString1.end() ) ? *str1 : wxUniChar( 0 );
864 c2 = ( str2 != aString2.end() ) ? *str2 : wxUniChar( 0 );
872 wxUniChar uc1 = wxToupper( c1 );
873 wxUniChar uc2 = wxToupper( c2 );
876 return uc1 < uc2 ? -1 : 1;
888 if( str1 != aString1.end() )
891 if( str2 != aString2.end() )
895 if( str1 == aString1.end() && str2 != aString2.end() )
899 else if( str1 != aString1.end() && str2 == aString2.end() )
909 bool case_sensitive )
911 const wxChar* cp =
nullptr;
912 const wxChar* mp =
nullptr;
913 const wxChar* wild =
nullptr;
914 const wxChar* str =
nullptr;
915 wxString _pattern, _string_to_tst;
919 wild = pattern.GetData();
920 str = string_to_tst.GetData();
925 _pattern.MakeUpper();
926 _string_to_tst = string_to_tst;
927 _string_to_tst.MakeUpper();
928 wild = _pattern.GetData();
929 str = _string_to_tst.GetData();
932 while( ( *str ) && ( *wild !=
'*' ) )
934 if( ( *wild != *str ) && ( *wild !=
'?' ) )
951 else if( ( *wild == *str ) || ( *wild ==
'?' ) )
963 while( *wild ==
'*' )
975 static const wxString modifiers( wxT(
"pnuµμmkKM" ) );
977 if( !aString.length() )
983 if( modifiers.Find( aString[ 0 ] ) >= 0 )
985 modifier = aString[ 0 ];
986 units = aString.Mid( 1 ).Trim();
991 units = aString.Mid( 0 ).Trim();
995 && !units.IsSameAs( wxT(
"F" ),
false )
996 && !units.IsSameAs( wxT(
"hz" ),
false )
997 && !units.IsSameAs( wxT(
"W" ),
false )
998 && !units.IsSameAs( wxT(
"V" ),
false )
999 && !units.IsSameAs( wxT(
"A" ),
false )
1000 && !units.IsSameAs( wxT(
"H" ),
false ) )
1005 if( modifier ==
'p' )
1007 if( modifier ==
'n' )
1009 else if( modifier ==
'u' || modifier == wxS(
"µ" )[0] || modifier == wxS(
"μ" )[0] )
1011 else if( modifier ==
'm' )
1013 else if( modifier ==
'k' || modifier ==
'K' )
1015 else if( modifier ==
'M' )
1017 else if( modifier ==
'G' )
1037 value->Replace( wxS(
" " ), wxEmptyString );
1039 wxChar ambiguousSeparator =
'?';
1040 wxChar thousandsSeparator =
'?';
1041 bool thousandsSeparatorFound =
false;
1042 wxChar decimalSeparator =
'?';
1043 bool decimalSeparatorFound =
false;
1046 for(
int ii = (
int) value->length() - 1; ii >= 0; --ii )
1048 wxChar c = value->GetChar( ii );
1050 if( c >=
'0' && c <=
'9' )
1054 else if( c ==
'.' || c ==
',' )
1056 if( decimalSeparator !=
'?' || thousandsSeparator !=
'?' )
1060 if( c == decimalSeparator )
1062 if( thousandsSeparatorFound )
1064 else if( decimalSeparatorFound )
1067 decimalSeparatorFound =
true;
1069 else if( c == thousandsSeparator )
1074 thousandsSeparatorFound =
true;
1077 else if( ambiguousSeparator !=
'?' )
1081 if( c == ambiguousSeparator )
1084 thousandsSeparator = ambiguousSeparator;
1085 thousandsSeparatorFound =
true;
1086 decimalSeparator = c ==
'.' ?
',' :
'.';
1091 decimalSeparator = ambiguousSeparator;
1092 decimalSeparatorFound =
true;
1093 thousandsSeparator = c;
1094 thousandsSeparatorFound =
true;
1106 if( ( ii == 1 && value->GetChar( 0 ) ==
'0' ) || digits != 3 )
1108 decimalSeparator = c;
1109 decimalSeparatorFound =
true;
1110 thousandsSeparator = c ==
'.' ?
',' :
'.';
1114 ambiguousSeparator = c;
1127 if( decimalSeparator ==
'?' && thousandsSeparator ==
'?' )
1129 const struct lconv* lc = localeconv();
1131 decimalSeparator = lc->decimal_point[0];
1132 thousandsSeparator = decimalSeparator ==
'.' ?
',' :
'.';
1136 value->Replace( thousandsSeparator, wxEmptyString );
1137 value->Replace( decimalSeparator,
'.' );
1150 wxString strFWordBeg, strFWordMid, strFWordEnd;
1151 wxString strSWordBeg, strSWordMid, strSWordEnd;
1154 SplitString( fWord, &strFWordBeg, &strFWordMid, &strFWordEnd );
1155 SplitString( sWord, &strSWordBeg, &strSWordMid, &strSWordEnd );
1158 int isEqual = strFWordBeg.CmpNoCase( strSWordBeg );
1164 else if( isEqual < 0 )
1171 double lFirstNumber = 0;
1172 double lSecondNumber = 0;
1173 bool endingIsModifier =
false;
1178 strFWordMid.ToCDouble( &lFirstNumber );
1179 strSWordMid.ToCDouble( &lSecondNumber );
1181 endingIsModifier |=
ApplyModifier( lFirstNumber, strFWordEnd );
1182 endingIsModifier |=
ApplyModifier( lSecondNumber, strSWordEnd );
1184 if( lFirstNumber > lSecondNumber )
1186 else if( lFirstNumber < lSecondNumber )
1189 else if( !endingIsModifier )
1190 return strFWordEnd.CmpNoCase( strSWordEnd );
1199 wxString* strBeginning,
1200 wxString* strDigits,
1203 static const wxString separators( wxT(
".," ) );
1206 strBeginning->Empty();
1211 if( strToSplit.length() == 0 )
1217 for( ii = (strToSplit.length() - 1); ii >= 0; ii-- )
1219 if( wxIsdigit( strToSplit[ii] ) )
1226 *strBeginning = strToSplit;
1231 *strEnd = strToSplit.substr( ii + 1 );
1234 int position = ii + 1;
1236 for( ; ii >= 0; ii-- )
1238 if( !wxIsdigit( strToSplit[ii] ) && separators.Find( strToSplit[ii] ) < 0 )
1244 *strDigits = strToSplit.substr( 0, position );
1250 *strDigits = strToSplit.substr( ii + 1, position - ii - 1 );
1251 *strBeginning = strToSplit.substr( 0, ii + 1 );
1265 int index = aStr.Len() - 1;
1269 const char chr = aStr.GetChar( index );
1271 if( chr <
'0' || chr >
'9' )
1274 number += ( chr -
'0' ) * base;
1291 bool changed =
false;
1293 result.reserve( aName->length() );
1295 for( std::string::iterator it = aName->begin(); it != aName->end(); ++it )
1313 *aName = std::move(
result );
1321 bool changed =
false;
1323 result.reserve( aName.Length() );
1326 for( wxString::iterator it = aName.begin(); it != aName.end(); ++it )
1328 if( illWChars.Find( *it ) != wxNOT_FOUND )
1333 result += wxString::Format(
"%%%02x", *it );
1344 aName = std::move(
result );
1350void wxStringSplit(
const wxString& aText, wxArrayString& aStrings, wxChar aSplitter )
1354 for(
unsigned ii = 0; ii < aText.Length(); ii++ )
1356 if( aText[ii] == aSplitter )
1358 aStrings.Add( tmp );
1367 if( !tmp.IsEmpty() )
1368 aStrings.Add( tmp );
1374 struct lconv* lc = localeconv();
1375 char sep = lc->decimal_point[0];
1376 unsigned sep_pos = aStringValue.Find( sep );
1381 unsigned min_len = sep_pos + aTrailingZeroAllowed + 1;
1383 while( aStringValue.Len() > min_len )
1385 if( aStringValue.Last() ==
'0' )
1386 aStringValue.RemoveLast();
1398 if( aValue != 0.0 && std::fabs( aValue ) <= 0.0001 )
1400 buf = fmt::format(
"{:.16f}", aValue );
1403 while( !buf.empty() && buf[buf.size() - 1] ==
'0' )
1410 if( buf[buf.size() - 1] ==
'.' )
1417 buf = fmt::format(
"{:.10g}", aValue );
1429 if( aValue != 0.0 && std::fabs( aValue ) <= 0.0001 )
1433 len = snprintf( buf,
sizeof( buf ),
"%.16f", aValue );
1435 while( --len > 0 && buf[len] ==
'0' )
1438 if( buf[len] ==
'.' || buf[len] ==
',' )
1447 len = snprintf( buf,
sizeof( buf ),
"%.10g", aValue );
1450 return std::string( buf, len );
1457 wxString line = wxString::FromUTF8( cstring );
1459 if( line.IsEmpty() )
1461 line = wxConvCurrent->cMB2WC( cstring );
1463 if( line.IsEmpty() )
1464 line = wxString::From8BitData( cstring );
1474 wxString line = wxString::FromUTF8( aString );
1476 if( line.IsEmpty() )
1478 line = wxConvCurrent->cMB2WC( aString.c_str() );
1480 if( line.IsEmpty() )
1481 line = wxString::From8BitData( aString.c_str() );
1490 wxString uriPathAndFileName;
1492 wxCHECK( aFileUri.StartsWith( wxS(
"file://" ), &uriPathAndFileName ), aFileUri );
1494 wxString tmp = uriPathAndFileName;
1495 wxString retv = wxS(
"file://" );
1497 tmp.Replace( wxS(
"\\" ), wxS(
"/" ) );
1498 tmp.Replace( wxS(
":" ), wxS(
"" ) );
1500 if( !tmp.IsEmpty() && tmp[0] !=
'/' )
1501 tmp = wxS(
"/" ) + tmp;
1512 std::pair<wxString, long> ParseAlphaNumericPin(
const wxString& pinNum )
1517 size_t numStart = pinNum.length();
1518 for(
int i =
static_cast<int>( pinNum.length() ) - 1; i >= 0; --i )
1520 if( !wxIsdigit( pinNum[i] ) )
1529 if( numStart < pinNum.length() )
1531 prefix = pinNum.Left( numStart );
1532 wxString numericPart = pinNum.Mid( numStart );
1533 numericPart.ToLong( &numValue );
1536 return { prefix, numValue };
1545 std::vector<wxString> expanded;
1547 const bool hasOpenBracket = aPinName.Contains( wxT(
"[" ) );
1548 const bool hasCloseBracket = aPinName.Contains( wxT(
"]" ) );
1550 if( hasOpenBracket || hasCloseBracket )
1552 if( !aPinName.StartsWith( wxT(
"[" ) ) || !aPinName.EndsWith( wxT(
"]" ) ) )
1556 expanded.push_back( aPinName );
1561 if( !aPinName.StartsWith( wxT(
"[" ) ) || !aPinName.EndsWith( wxT(
"]" ) ) )
1563 expanded.push_back( aPinName );
1567 const wxString inner = aPinName.Mid( 1, aPinName.Length() - 2 );
1570 while( start < inner.length() )
1572 size_t comma = inner.find(
',', start );
1573 wxString part = ( comma == wxString::npos ) ? inner.Mid( start ) : inner.Mid( start, comma - start );
1574 part.Trim(
true ).Trim(
false );
1577 start = ( comma == wxString::npos ) ? inner.length() : comma + 1;
1581 int dashPos = part.Find(
'-' );
1582 if( dashPos != wxNOT_FOUND )
1584 wxString startTxt = part.Left( dashPos );
1585 wxString endTxt = part.Mid( dashPos + 1 );
1586 startTxt.Trim(
true ).Trim(
false );
1587 endTxt.Trim(
true ).Trim(
false );
1589 auto [startPrefix, startVal] = ParseAlphaNumericPin( startTxt );
1590 auto [endPrefix, endVal] = ParseAlphaNumericPin( endTxt );
1592 if( startPrefix != endPrefix || startVal == -1 || endVal == -1 || startVal > endVal )
1597 expanded.push_back( aPinName );
1601 for(
long ii = startVal; ii <= endVal; ++ii )
1603 if( startPrefix.IsEmpty() )
1604 expanded.emplace_back( wxString::Format( wxT(
"%ld" ), ii ) );
1606 expanded.emplace_back( wxString::Format( wxT(
"%s%ld" ), startPrefix, ii ) );
1611 expanded.push_back( part );
1614 if( comma == wxString::npos )
1619 if( expanded.empty() )
1621 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.
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)
bool ConvertSmartQuotesAndDashes(wxString *aString)
Convert curly quotes and em/en dashes to straight quotes and dashes.
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.