SplitElementName

C++ Function Reference

1 Signature

fullpath BigDataStatMeth::SplitElementName(std::string str)

2 Description

Splits a full file path into directory path and filename.

3 Parameters

  • str (std::string): Full file path

4 Returns

fullpath Structure containing separated path and filename

5 Details

strFull file path fullpath Structure containing separated path and filename Handles both forward and backward slashes for cross-platform compatibility

6 Call Graph

Function dependencies

7 Source Code

File: inst/include/Utilities/Utilities.hppLines 94-107

inline fullpath SplitElementName (std::string str)
    {
        fullpath currentpath;
        std::size_t found = str.find_last_of("/\\");
        
        if( found< str.length() ) {
            currentpath.filename =  str.substr(found+1);
            currentpath.path = str.substr(0,found);
        }else {
            currentpath.filename = str;
            currentpath.path = "";
        }
        return(currentpath);
    }

8 Usage Example

#include "BigDataStatMeth.hpp"

// Example usage
auto result = SplitElementName(...);