05AB1E, 6 (削除) 6 (削除ここまで)(削除) 5 (削除ここまで) 3 bytes
DgI+FÁ(._
Try it online Inputs in the order integer,string.
Try it online or verify all test cases verify all test cases.
Explanation:
D( # Negate the first (implicit) input-integer
._ # DuplicateRotate the textsecond (implicit) input-string gthat many times towards the left
# Take(which it'ssupports length
negative integers as rotating right instead)
# i.e.(after "Testing..."which →the 10
result is Ioutput implicitly)
05AB1E (legacy) , (削除) 6 (削除ここまで) 5 bytes
sg+FÁ
Inputs in the order integer,string.
Try it online or verify all test cases .
Explanation:
s # TakeSwap so the integertwo input
(implicit) inputs are +in reversed order on the stack
#g Add them together
# Pop and push the length of the #top input-string
i.e. 10+ and -3 → 7
# Add it to Fthe input-integer
F # Loop that many times
Á # And rotate once towards the right during every iteration
# (using the last implicit input-string in the first iteration)
Since the legacy version of 05AB1E only has builtins for Rotate once towards the right/left, and not Rotate N\$n\$ amount towards the right/left, I loop length + input\$length + input\$ amount of times and rotate that many times towards the right.
For example:
- "Testing..."
"Testing..."and -3 will rotate10 + -3 = 7will rotate \10ドル + -3 = 7\$ times towards the right, resulting inting...Tes. - "Hello world"
"Hello world"and 5 will rotate11 + 5 = 16will rotate \11ドル + 5 = 16\$ times towards the right, resulting inworldHello.
The new version of 05AB1E does have a builtin for rotating \$n\$ amount of times towards the left, which is ._, saving 2 bytes .
05AB1E, 6 bytes
DgI+FÁ
Try it online or verify all test cases.
Explanation:
D # Duplicate the text input g # Take it's length
# i.e. "Testing..." → 10
I # Take the integer input
+ # Add them together
# i.e. 10 and -3 → 7
F # Loop that many times
Á # And rotate once towards the right during every iteration
Since 05AB1E only has builtins for Rotate once towards the right/left, and not Rotate N amount towards the right/left, I loop length + input amount of times and rotate that many times towards the right.
For example:
- "Testing..." and -3 will rotate
10 + -3 = 7times towards the right, resulting inting...Tes. - "Hello world" and 5 will rotate
11 + 5 = 16times towards the right, resulting inworldHello.
05AB1E, (削除) 6 (削除ここまで)(削除) 5 (削除ここまで) 3 bytes
(._
Inputs in the order integer,string.
Try it online or verify all test cases.
Explanation:
( # Negate the first (implicit) input-integer
._ # Rotate the second (implicit) input-string that many times towards the left
# (which supports negative integers as rotating right instead)
# (after which the result is output implicitly)
05AB1E (legacy) , (削除) 6 (削除ここまで) 5 bytes
sg+FÁ
Inputs in the order integer,string.
Try it online or verify all test cases .
Explanation:
s # Swap so the two (implicit) inputs are in reversed order on the stack
g # Pop and push the length of the top input-string
+ # Add it to the input-integer
F # Loop that many times
Á # And rotate once towards the right during every iteration
# (using the last implicit input-string in the first iteration)
Since the legacy version of 05AB1E only has builtins for Rotate once towards the right/left, and not Rotate \$n\$ amount towards the right/left, I loop \$length + input\$ amount of times and rotate that many times towards the right.
For example:
"Testing..."and-3will rotate \10ドル + -3 = 7\$ times towards the right, resulting inting...Tes."Hello world"and5will rotate \11ドル + 5 = 16\$ times towards the right, resulting inworldHello.
The new version of 05AB1E does have a builtin for rotating \$n\$ amount of times towards the left, which is ._, saving 2 bytes .
05AB1E , 6 bytes
DgI+FÁ
Try it online or verify all test cases.
Explanation:
D # Duplicate the text input
g # Take it's length
# i.e. "Testing..." → 10
I # Take the integer input
+ # Add them together
# i.e. 10 and -3 → 7
F # Loop that many times
Á # And rotate once towards the right during every iteration
Since 05AB1E only has builtins for Rotate once towards the right/left, and not Rotate N amount towards the right/left, I loop length + input amount of times and rotate that many times towards the right.
For example:
- "Testing..." and -3 will rotate
10 + -3 = 7times towards the right, resulting inting...Tes. - "Hello world" and 5 will rotate
11 + 5 = 16times towards the right, resulting inworldHello.
DgI+FÁ
Try it online or verify all test cases.
Explanation:
D # Duplicate the text input
g # Take it's length
# i.e. "Testing..." → 10
I # Take the integer input
+ # Add them together
# i.e. 10 and -3 → 7
F # Loop that many times
Á # And rotate once towards the right during every iteration
Since 05AB1E only has builtins for Rotate once towards the right/left, and not Rotate N amount towards the right/left, I loop length + input amount of times and rotate that many times towards the right.
For example:
- "Testing..." and -3 will rotate
10 + -3 = 7times towards the right, resulting inting...Tes. - "Hello world" and 5 will rotate
11 + 5 = 16times towards the right, resulting inworldHello.
05AB1E , 6 bytes
DgI+FÁ
Try it online or verify all test cases.
Explanation:
D # Duplicate the text input
g # Take it's length
# i.e. "Testing..." → 10
I # Take the integer input
+ # Add them together
# i.e. 10 and -3 → 7
F # Loop that many times
Á # And rotate once towards the right during every iteration
Since 05AB1E only has builtins for Rotate once towards the right/left, and not Rotate N amount towards the right/left, I loop length + input amount of times and rotate that many times towards the right.
For example:
- "Testing..." and -3 will rotate
10 + -3 = 7times towards the right, resulting inting...Tes. - "Hello world" and 5 will rotate
11 + 5 = 16times towards the right, resulting inworldHello.
DgI+FÁ
Try it online or verify all test cases.
Explanation:
D # Duplicate the text input
g # Take it's length
# i.e. "Testing..." → 10
I # Take the integer input
+ # Add them together
# i.e. 10 and -3 → 7
F # Loop that many times
Á # And rotate once towards the right during every iteration
Since 05AB1E only has builtins for Rotate once towards the right/left, and not Rotate N amount towards the right/left, I loop length + input amount of times and rotate that many times towards the right.
For example:
- "Testing..." and -3 will rotate
10 + -3 = 7times towards the right, resulting inting...Tes. - "Hello world" and 5 will rotate
11 + 5 = 16times towards the right, resulting inworldHello.