Given strings like:

Bob
Bob,
Bob
Bob Burns,

How can you return that w/o a comma?

Bob
Bob
Bob
Bob Burns

Also, I would want this method not to break if passed a nil, just to return a nil?

def remove_trailing_comma(str)
  !str.nil? ? str.replace(",") :nil
end
Edit
Report