utils: cleanup whitespace
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright (C) 2017 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
** Copyright (C) 2017-2021 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||||
**
|
**
|
||||||
** This library is free software; you can redistribute it and/or
|
** This library is free software; you can redistribute it and/or
|
||||||
** modify it under the terms of the GNU Lesser General Public License
|
** modify it under the terms of the GNU Lesser General Public License
|
||||||
@ -147,6 +147,9 @@ Mu::utf8_clean (const std::string& dirty)
|
|||||||
clean.erase (clean.find_last_not_of(" ") + 1); // remove trailing space
|
clean.erase (clean.find_last_not_of(" ") + 1); // remove trailing space
|
||||||
|
|
||||||
return clean;
|
return clean;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
Mu::remove_ctrl (const std::string& str)
|
Mu::remove_ctrl (const std::string& str)
|
||||||
{
|
{
|
||||||
@ -165,6 +168,7 @@ Mu::remove_ctrl (const std::string& str)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<std::string>
|
std::vector<std::string>
|
||||||
Mu::split (const std::string& str, const std::string& sepa)
|
Mu::split (const std::string& str, const std::string& sepa)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright (C) 2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
** Copyright (C) 2020-2021 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||||
**
|
**
|
||||||
** This library is free software; you can redistribute it and/or
|
** This library is free software; you can redistribute it and/or
|
||||||
** modify it under the terms of the GNU Lesser General Public License
|
** modify it under the terms of the GNU Lesser General Public License
|
||||||
@ -43,8 +43,6 @@ using StringVec = std::vector<std::string>;
|
|||||||
std::string utf8_flatten (const char *str);
|
std::string utf8_flatten (const char *str);
|
||||||
inline std::string utf8_flatten (const std::string& s) { return utf8_flatten(s.c_str()); }
|
inline std::string utf8_flatten (const std::string& s) { return utf8_flatten(s.c_str()); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace all control characters with spaces, and remove leading and trailing space.
|
* Replace all control characters with spaces, and remove leading and trailing space.
|
||||||
*
|
*
|
||||||
@ -55,6 +53,19 @@ inline std::string utf8_flatten (const std::string& s) { return utf8_flatten(s.c
|
|||||||
std::string utf8_clean (const std::string& dirty);
|
std::string utf8_clean (const std::string& dirty);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove ctrl characters, replacing them with ' '; subsequent
|
||||||
|
* ctrl characters are replaced by a single ' '
|
||||||
|
*
|
||||||
|
* @param str a string
|
||||||
|
*
|
||||||
|
* @return the string without control characters
|
||||||
|
*/
|
||||||
|
std::string remove_ctrl (const std::string& str);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Split a string in parts
|
* Split a string in parts
|
||||||
*
|
*
|
||||||
|
|||||||
@ -214,6 +214,7 @@ main (int argc, char *argv[])
|
|||||||
g_test_add_func ("/utils/date-ymwdhMs", test_date_ymwdhMs);
|
g_test_add_func ("/utils/date-ymwdhMs", test_date_ymwdhMs);
|
||||||
g_test_add_func ("/utils/size", test_size);
|
g_test_add_func ("/utils/size", test_size);
|
||||||
g_test_add_func ("/utils/flatten", test_flatten);
|
g_test_add_func ("/utils/flatten", test_flatten);
|
||||||
|
g_test_add_func ("/utils/remove-ctrl", test_remove_ctrl);
|
||||||
g_test_add_func ("/utils/clean", test_clean);
|
g_test_add_func ("/utils/clean", test_clean);
|
||||||
g_test_add_func ("/utils/format", test_format);
|
g_test_add_func ("/utils/format", test_format);
|
||||||
g_test_add_func ("/utils/define-bitmap", test_define_bitmap);
|
g_test_add_func ("/utils/define-bitmap", test_define_bitmap);
|
||||||
|
|||||||
Reference in New Issue
Block a user