I\'m looking for a way to rotate a string in c++. I spend all of my time in python, so my c++ is very rusty.
Here is what I want it to do: if I have a strin
this code worked for me:
using namespace std; string StrRotate(string &s, int nLeft) { int size = s.size(); nLeft %= size; if(nLeft == 0) return s; string after = s.substr(0, nLeft); string before = s.substr(nLeft, size - nLeft); return before + after; }