// Strip pattern from text if present FXString FXFileSelector::patternFromText(const FXString& pattern){ FXint beg,end; end=pattern.rfind(')'); // Search from the end so we can allow ( ) in the pattern name itself beg=pattern.rfind('(',end-1); if(0<=beg && beg<end) return pattern.mid(beg+1,end-beg-1); return pattern; }
// Remove anything containing a colon : from the beginning of the string. // Returns number of colons removed. FXint TagParserBase::StripNamespace(FXString &s) { FXint rv=s.contains(':'); if (rv) { s.erase(0,s.rfind(':')+1); } return rv; }
FXString MFXUtils::assureExtension(const FXString &filename, const FXString &defaultExtension) throw() { FXString ext = FXPath::extension(filename); if (ext=="") { if (filename.rfind('.')==filename.length()-1) { return filename + defaultExtension; } return filename + "." + defaultExtension; } return filename; }
// Get frame number from filename static FXint frameFromFilename(const FXString& file){ FXint head=file.rfind(PATHSEP)+1; FXint tail=file.find('.',head); FXint frame=0; if(0<tail){ FXint wgt=1; while(head<tail && Ascii::isDigit(file[tail-1])){ frame+=wgt*Ascii::digitValue(file[--tail]); wgt*=10; } } return frame; }