mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Remove spaces from Source name
Replace space by underscore
This commit is contained in:
@@ -104,6 +104,16 @@ std::string BaseToolkit::transliterate(const std::string &input)
|
||||
}
|
||||
|
||||
|
||||
std::string BaseToolkit::unspace(const std::string &input)
|
||||
{
|
||||
std::string output = input;
|
||||
for(std::size_t i = 0; i < output.length(); ++i) {
|
||||
if( isspace(output[i]) )
|
||||
output[i] = '_';
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
std::string BaseToolkit::byte_to_string(long b)
|
||||
{
|
||||
double numbytes = static_cast<double>(b);
|
||||
|
||||
@@ -16,6 +16,9 @@ std::string uniqueName(const std::string &basename, std::list<std::string> exist
|
||||
// get a transliteration to Latin of any string
|
||||
std::string transliterate(const std::string &input);
|
||||
|
||||
// replaces spaces by underscores in a string
|
||||
std::string unspace(const std::string &input);
|
||||
|
||||
// get a string to display memory size with unit KB, MB, GB, TB
|
||||
std::string byte_to_string(long b);
|
||||
|
||||
|
||||
@@ -347,7 +347,7 @@ Source::~Source()
|
||||
void Source::setName (const std::string &name)
|
||||
{
|
||||
if (!name.empty())
|
||||
name_ = BaseToolkit::transliterate(name);
|
||||
name_ = BaseToolkit::unspace( BaseToolkit::transliterate(name) );
|
||||
|
||||
initials_[0] = std::toupper( name_.front(), std::locale("C") );
|
||||
initials_[1] = std::toupper( name_.back(), std::locale("C") );
|
||||
|
||||
Reference in New Issue
Block a user