get_SplitData_in_vectorString

C++ Function Reference

1 Signature

std::vector< std::string > BigDataStatMeth::get_SplitData_in_vectorString(std::string line, std::regex reg_expres)

2 Description

Splits a string into fields based on a regular expression.

3 Parameters

  • line (std::string): Input string to be split
  • reg_expres (std::regex): Regular expression defining the splitting pattern

4 Returns

std::vector Vector containing the split substrings

5 Details

lineInput string to be split reg_expresRegular expression defining the splitting pattern std::vector Vector containing the split substringsget_data_as_Matrix() for numeric conversion of the split data

6 Caller Graph

Function dependencies

7 Source Code

File: inst/include/hdf5Utilities/hdf5ImportFiles.hppLines 66-82

inline std::vector<std::string> get_SplitData_in_vectorString(std::string line, std::regex reg_expres)
    {
        std::vector<std::string> strValues;

        // Split line in columns by delim (reg_xpres)
        std::sregex_token_iterator
        begin(line.begin(), line.end(), reg_expres),
        end;

        // write all the words to strValues
        std::copy(begin, end, std::back_inserter(strValues));
        
        // for (auto i: strValues)
        //     std::cout << i << ' ';

        return(strValues);
    }

8 Usage Example

#include "BigDataStatMeth.hpp"

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