MCPcopy Create free account
hub / github.com/LASzip/LASzip / FileExtSet

Function FileExtSet

src/mydefs.cpp:473–481  ·  view source on GitHub ↗

replace file extension of input_file with new extension (with or without leading '.')

Source from the content-addressed store, hash-verified

471
472// replace file extension of input_file with new extension (with or without leading '.')
473std::string FileExtSet(std::string fn_in, std::string ext_new) {
474 if (!ext_new.empty() && (ext_new[0] != '.')) ext_new = '.' + ext_new;
475 size_t pos = fn_in.find_last_of('.');
476 if (pos == std::string::npos) {
477 return fn_in + ext_new;
478 } else {
479 return fn_in.substr(0, pos) + ext_new;
480 }
481}
482
483/// Returns the extension of the file
484std::string getFileExtension(const char* filepath) {

Callers 2

readMethod · 0.85
writeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected