-1
ret += ": " + param.substr(tmp, rtmp);

I've tried and searched something useful to capitalize the first letter of the line above(substring) but had no success.

std::string ret = "stackoverflow";

    if(param.length())
    {
        trimString(param);

        size_t tmp = 0, rtmp = param.length();
        if(param[0] == '"')
            tmp = 1;

        if(param[rtmp] == '"')
            rtmp -= 1;

        ret += ": " + param.substr(tmp, rtmp);
    }

How it works?

Text

stackoverflow "whatever

Output

stackoverflow: whatever

And this is what i'm looking for

stackoverflow: Whatever
J. Doe
  • 3
  • 3

1 Answers1

1

Take

 ret += ": " + param.substr(tmp, rtmp);

And, first, extract the substring into a temporary variable, then uppercase the first letter:

 std::string s=param.substr(tmp, rtmp);

 s[0]=toupper(s[0]);

 ret += ": " + s;
Sam Varshavchik
  • 114,536
  • 5
  • 94
  • 148