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

Function FileExtSet

LASzip/src/mydefs.cpp:469–477  ·  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

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

Callers 2

readMethod · 0.85
writeMethod · 0.85

Calls 1

emptyMethod · 0.80

Tested by

no test coverage detected