Well, you could erase()
the first character too (note that erase()
modifies the string):
m_VirtualHostName.erase(0, 1);
m_VirtualHostName.erase(m_VirtualHostName.size() - 1);
But in this case, a simpler way is to take a substring:
m_VirtualHostName = m_VirtualHostName.substr(1, m_VirtualHostName.size() - 2);
Be careful to validate that the string actually has at least two characters in it first...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…