History

refactor extension matching

Ge Wang committed 3 years ago

Commit dcebc361 parent 5a68b864 files · +26 −33Browse files

Showing the changes to src/core/util_string.cpp (1 of 4 files). Show all

Unified · Split

src/core/util_string.cpp+16−0
@@ -723,3 +723,19 @@ t_CKBOOL is_absolute_path( const std::string & path ) · 722 unmodified lines
723 return( path.length() != 0 && path[0] == '/' );723 return( path.length() != 0 && path[0] == '/' );
724#endif724#endif
725}725}
726
727
728
729
730//-----------------------------------------------------------------------------
731// name: extension_matches()
732// desc: check whether a filename matches a particular extension
733//-----------------------------------------------------------------------------
734t_CKBOOL extension_matches( const char * filename, const char * extension )
735{
736 t_CKUINT extension_length = strlen( extension );
737 t_CKUINT filename_length = strlen( filename );
738
739 return strncmp( extension, filename+(filename_length-extension_length),
740 extension_length ) == 0;
741}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t