There seems to be no standard constructor, so I did the following
void myMethod(char delimiter = ',') { string delimiterString = 'x'; delimiterString[0] = delimiter; // use string version ... }
Is there a better way to do this?
std::string has a constructor that will do this for you:
std::string
std::string delimiterString(1, delimiter);
1 is size_tand denotes the number of times the argument is repeated char.
size_t
char
Source: https://habr.com/ru/post/1714183/More articles:How to get an address in C? - cDoes source incompatibility always mean binary incompatibility? - c ++PHP Chat Bot: Google Talk - phpSQL: SELECT IN is faster and better? - sqlC # .NET runtime object type - reflectionWhat is wrong with this use of the new operator? - c ++visualize complex organizational chart similar to javascript / flash / java graphics library - javaCreate GQL with "IN" query for ReferenceProperty - google-app-engineHow do you prototype your programming interface? - prototypeChecking SOAP Messages - SoapAll Articles