• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

paulmthompson / WhiskerToolbox / 15430655463

04 Jun 2025 12:26AM UTC coverage: 40.974% (+17.1%) from 23.832%
15430655463

push

github

paulmthompson
fix self copy with mask data

5 of 5 new or added lines in 2 files covered. (100.0%)

945 existing lines in 24 files now uncovered.

3003 of 7329 relevant lines covered (40.97%)

731.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/WhiskerToolbox/DataManager/utils/string_manip.hpp
1
#ifndef STRING_MANIP_HPP
2
#define STRING_MANIP_HPP
3

4
#include <iomanip>
5
#include <iostream>
6
#include <regex>
7
#include <sstream>
8
#include <string>
9

10

11
//https://stackoverflow.com/questions/30073839/c-extract-number-from-the-middle-of-a-string
12
inline std::string extract_numbers_from_string(std::string const & input) {
×
13
    std::string output = std::regex_replace(
14
            input,
15
            std::regex("[^0-9]*([0-9]+).*"),
×
16
            std::string("$1"));
×
17
    std::cout << input << std::endl;
×
18
    std::cout << output << std::endl;
×
19

20
    return output;
×
21
};
×
22

23
//https://stackoverflow.com/questions/6417817/easy-way-to-remove-extension-from-a-filename
24
inline std::string remove_extension(std::string const & filename) {
25
    size_t const lastdot = filename.find_last_of('.');
26
    if (lastdot == std::string::npos) return filename;
27
    return filename.substr(0, lastdot);
28
}
29

30
/**
31
 *
32
 * Creates a string of a number that is left padded with zeros
33
 * to be pad_digits long.
34
 *
35
 * @brief pad_frame_id
36
 * @param number_to_pad
37
 * @param pad_digits
38
 * @return
39
 */
UNCOV
40
inline std::string pad_frame_id(int const number_to_pad, int const pad_digits) {
×
UNCOV
41
    std::stringstream ss;
×
UNCOV
42
    ss << std::setw(pad_digits) << std::setfill('0') << number_to_pad;
×
43

UNCOV
44
    return ss.str();
×
UNCOV
45
}
×
46

47
// https://www.cespedes.org/blog/85/how-to-escape-latex-special-characters
48
// For now only underscores are needed
49
inline std::string escape_latex(std::string const & s) {
50
    return std::regex_replace(s, std::regex("_"), std::string("\\_"));
51
}
52

53
#endif// STRING_MANIP_HPP
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc