I made this simple code which makes easy HTML tag generation. It is open-source and right now only makes tag names and replaces tags... :/
#include <iostream>
#include <fstream>
std::string makeHtmlTags(std::string tagname, std::string tagcontent) {
return "<" + tagname + ">" + tagcontent + "</" + tagname + ">";
}
void changeHtmlTag(std::string * tag, std::string newtagname)
{
if(tag->at(2) != '/')
*tag = "<" + newtagname + ">";
else
*tag = "</" + newtagname + ">";
}
int main()
{
std::string html = makeHtmlTags("hello", "world");
std::string tag1 = html.substr(2, 5);
changeHtmlTag(&tag1, "goodbye");
changeHtmlTag(&tag1, "/goodbye");
std::cout << tag1;
}
What can I do to make it more useful?