Wrap Around

Published by Sinomede in

Create a function to reproduce the wrap around effect shown:

Examples

WrapAround("Hello, World!", 2) ➞ "llo, World!He"

WrapAround("From what I gathered", -4) ➞ "eredFrom what I gath"

WrapAround("Excelsior", 30) ➞ "elsiorExc"

WrapAround("Nonscience", -116) ➞ "cienceNons"

Notes

  • The offset can be negative.
  • The offset can be greater than the input string's length.
Watch a quick demo on how Edabit works.