Mercurial > public > cpp-enigma
comparison enigma/enigma_utils.cpp @ 4:2792ca4ffa84
Created enigma_machine class and tests.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 24 Jun 2012 18:39:05 -0500 |
parents | |
children | 424111a36ed7 |
comparison
equal
deleted
inserted
replaced
3:f4e25e6b76c3 | 4:2792ca4ffa84 |
---|---|
1 // Copyright (C) 2012 by Brian Neal. | |
2 // This file is part of Cpp-Enigma, the Enigma Machine simulation. | |
3 // Cpp-Enigma is released under the MIT License (see License.txt). | |
4 // | |
5 // enigma_utils.cpp - Implementation file for enigma_utils.h. | |
6 | |
7 #include "enigma_utils.h" | |
8 | |
9 std::string enigma::remove_spaces(const std::string& s) | |
10 { | |
11 std::string result; | |
12 result.reserve(s.size()); | |
13 | |
14 for (const auto& c : s) | |
15 { | |
16 if (c != ' ') | |
17 { | |
18 result += c; | |
19 } | |
20 } | |
21 return result; | |
22 } |