Wrap Around

Published by Mubashir Hassan 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 length of str.
Watch a quick demo on how Edabit works.