Reputation: 827
I'm trying to insert a string into another string like you would with append()
but rather than at the end I'd like to put it before the occurrence of ".xlsx".
string docName;
docName = "../Toyota Tacoma " + customer.toStdString() + " .xlsx";
if(sold = true){
docName = docName.append("(sold)");
}
doc.CreateDocument(docName);
This code just appends "(sold)" after ".xlsx"
Upvotes: 1
Views: 233
Reputation: 35154
Simply rewrite the code a bit, such that you do not have to insert at all:
string docName;
docName = "../Toyota Tacoma " + customer.toStdString();
if(sold == true){
docName += "(sold)";
}
docName += ".xlsx";
doc.CreateDocument(docName);
Upvotes: 5