Post History
Scala, 98 83 bytes Saved 15 bytes thanks to Shaggy! a=>t=>{val w=a.map(_.size).max (" "*(w-t.size>>1)+t)+:a:+" "*(w/2-5)+"BOTTOM TEXT"} Try it online! a is the ASCII art, t is th...
Answer
#3: Post edited
# Scala, 98 bytes- ```scala
- a=>t=>{val w=a.map(_.size).max
(" "*(w-t.size>>1)+t)+:a:+" "*(w-11>>1)+"BOTTOM TEXT"mkString "\n"}- ```
[Try it online!](https://scastie.scala-lang.org/c2NXrP46R6CsDTkeHV7oPw)`a` is the ASCII art, `t` is the string on top. `w` is the size of the longest line in the art, used for centering. A line `x` can be centered using `" "*(w-x.size>>1)+x` (no padding on the right side). We do that for both `t` and `BOTTOM TEXT`, then join on newlines.
- # Scala, <s>98</s> 83 bytes
- Saved 15 bytes thanks to Shaggy!
- ```scala
- a=>t=>{val w=a.map(_.size).max
- (" "*(w-t.size>>1)+t)+:a:+" "*(w/2-5)+"BOTTOM TEXT"}
- ```
- [Try it online!](https://scastie.scala-lang.org/aP3iJji2RSqWPB2Z7Mlheg)
- `a` is the ASCII art, `t` is the string on top. `w` is the size of the longest line in the art, used for centering. A line `x` can be centered using `" "*((w-x.size)/2)+x` (no padding on the right side). We do that for both `t` and `BOTTOM TEXT`, then join on newlines.
#2: Post edited
- # Scala, 98 bytes
- ```scala
- a=>t=>{val w=a.map(_.size).max
- (" "*(w-t.size>>1)+t)+:a:+" "*(w-11>>1)+"BOTTOM TEXT"mkString "\n"}
- ```
[Try it online!](https://scastie.scala-lang.org/c2NXrP46R6CsDTkeHV7oPw)
- # Scala, 98 bytes
- ```scala
- a=>t=>{val w=a.map(_.size).max
- (" "*(w-t.size>>1)+t)+:a:+" "*(w-11>>1)+"BOTTOM TEXT"mkString "\n"}
- ```
- [Try it online!](https://scastie.scala-lang.org/c2NXrP46R6CsDTkeHV7oPw)
- `a` is the ASCII art, `t` is the string on top. `w` is the size of the longest line in the art, used for centering. A line `x` can be centered using `" "*(w-x.size>>1)+x` (no padding on the right side). We do that for both `t` and `BOTTOM TEXT`, then join on newlines.