Yes number 1 by far. Number 1 you are passing the memory address of the string then you are directly modifying that string at the memory address. Number two you are passing a variable then copying it to a local variable, modify the copied variable, then return another copy of that variable. So altogether you created 2 new strings and then now you have to assign that to your old string.
When they said "better" I assumed faster and less memory being used. That would mean number 1. Also booradley can you explain your reasoning on being "better" because it is returning a copy? Just an fyi strings are complex objects and generally speaking you want to pass/return complex objects are references. Anyways it is always faster to pass by reference/return by reference versus passing/returning by copy. When ever you pass/call by copy you are calling the class constructor. So instead of calling 1 constructor ( when the object is created ) you are now calling the constructor 3 times. Then afterwards you now have to assign that value to the old string.
*I see he interpreted it as keeping the original and assigning to another variable.
It depends on what you need it to do ('you' being in the general sense the function that will call this uprStr one). If you call it expecting to get a new string (and not overwriting the one you started with) then the pass-by-value semantics is desirable. Pass-by-value also allows you to call the method and pass a string literal as the parameter. If best is only defined by speed of execution, then you're right. I was looking at it from a sense of how useable is it if it destroys every original string you send to it?