ツイートできたぞ!!!(#47)(#48)(#49)

This commit is contained in:
keita
2021-02-17 00:20:35 +09:00
parent 35394bd0ea
commit 45402eb217
8 changed files with 68 additions and 67 deletions
+16 -15
View File
@@ -1,21 +1,22 @@
#include "cocoatweet/util/util.h"
#include <cctype>
namespace CocoaTweet::Util{
std::string urlEncode(const std::string& _str){
std::stringstream out;
namespace CocoaTweet::Util {
std::string urlEncode(const std::string& _str) {
std::stringstream out;
for(const auto c : _str){
if(std::isalpha(c) || std::isdigit(c) || (c == '.' || (c == '_') || (c == '-' || (c == '~')))){
out << c;
}else{
out << '%' << std::hex << std::uppercase << static_cast<int>(c);
}
}
for (const auto c : _str) {
if (std::isalpha(c) || std::isdigit(c) ||
(c == '.' || (c == '_') || (c == '-' || (c == '~')))) {
out << c;
} else {
out << '%' << std::hex << std::uppercase << static_cast<int>(c);
}
}
return out.str();
}
template<typename T>
std::string join(const std::vector<T> _vec){}
return out.str();
}
template <typename T>
std::string join(const std::vector<T> _vec) {}
} // namespace CocoaTweet::Util