Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Modeled after take (cycle str) from haskell
- string
- takeCycle( string &pattern, int length )
- {
- string output = "";
- int tmpLen;
- // Use a temporary int to preserve `length`
- for ( tmpLen = length ; tmpLen > 0; tmpLen-- )
- {
- output.append( pattern, 0, 1 );
- rotateStringLeft( pattern );
- }
- return output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement