[Question]
  [
**EDIT** I modified the wording of the rules to make some things which were implicit more explicit. I also added some emphasis to clear up some points of apparent confusion, and explicitly defined the option of making a standalone program instead of a function.
The goal here is to make a function that takes a text file (or string) and transposes it so that lines become columns and vice versa.
**Example:**
```
I am a text.
Transpose me.
Can you do it?
```
Results in:
```
ITC
 ra
aan
mn
 sy
apo
 ou
ts
eed
x o
tm
.ei
 .t
  ?
```
**The rules:**
* You are allowed to assume that the only whitespace characters used are `" "` and `"\n"` and that there is no trailing whitespace on any line.
* You may assume that the file is ASCII. Which endline marker you want to use is up to you.(CRLF or LF). It must work correctly on the example, but it should also work on **any** input that satisfies the above assumptions.
* You might have to insert spaces (as in the example) where there were none in order to keep the columns in line.
* Your result **must not** have trailing whitespace **on any line**.
* The final newline character(for the last line) is optional.
* **It should be either a function or a complete program.** If your **function** accepts a string, then it should return the results as a string. If it accepts a filename, then you return the name of the file where you saved the result. You are additionally allowed to write a **complete program** that accepts input from STDIN and outputs the correct result to STDOUT; if you do this, you must **not** output anything to STDERR.
* Shortest procedure wins, but I will upvote any answer I like.
Based on the rules, the output on the example is either 53 or 52 bytes long (for LF newlines) depending on whether the final newline is included or not.
**Note:** It is not a specific requirement, but if your function, when run twice successively is not identical to the original(the final newline might be differ, and any empty lines at the end of the file will be deleted), then you are *probably* breaking one of the rules.
  
[Answer]
##  J (~~31~~ 40)
```
f=:3 :';(,&LF@dlb&.|.)&.><"1|:>LF cut y'
```
This is a function that takes a string, and returns a string (i.e. a character *vector* with linefeeds inserted in the right places, and not a matrix.)
Edit: no trailing whitespace on any line.
Test:
```
   f=:3 :';(,&LF@dlb&.|.)&.><"1|:>LF cut y'
   string=:stdin''
I am a text.
Transpose me.
Can you do it?
^D
   $string
42
   $f string
53
   f string
ITC
 ra
aan
mn
 sy
apo
 ou
ts
eed
x o
tm
.ei
 .t
  ?
```
[Answer]
**Ruby 111**
Golfed:
```
def f t;s=t.lines;s.map{|l|l.chomp.ljust(s.map(&:size).max).chars}.transpose.map{|l|l.join.rstrip+?\n}.join;end
```
Ungolfed:
```
def transpose_text(text)
  max_length = text.lines.map(&:size).max
  text.lines.map do |line|
    line.chomp.ljust(max_length).chars
  end.transpose.map do |chars|
    chars.join.rstrip + "\n"
  end.join
end
```
Ruby has an array transpose function, so this simply pads the lines out, turns them into an array of characters, uses Ruby's Array#transpose function, then turns the array of characters back into lines.
Golfing it was simply using single-character identifiers, removing spaces, using a temporary for text.lines, and putting the calculation for max\_length inline (there are no points for efficiency).
[Answer]
## R, 171
```
function(e){p=strsplit
x=t(plyr::rbind.fill.matrix(lapply(p(p(e,"\n")[[1]],""),t)))
x[is.na(x)]=" "
cat(apply(x,1,function(y)sub(" *$","",paste(y,collapse=""))),sep="\n")}
```
Usage example:
```
text <- "I am a text.
Transpose me.
Can you do it?"
(function(e){p=strsplit
x=t(plyr::rbind.fill.matrix(lapply(p(p(e,"\n")[[1]],""),t)))
x[is.na(x)]=" "
cat(apply(x,1,function(y)sub(" *$","",paste(y,collapse=""))),sep="\n")})(text)
ITC
 ra
aan
mn
 sy
apo
 ou
ts
eed
x o
tm
.ei
 .t
  ?
```
Trailing whitespace is removed.
[Answer]
**Python 2.7 (~~97~~ ~~79~~ ~~94~~ 90)**
EDIT: Missed the function requirement;
I'm fairly sure this will be improved on since I'm sort of a beginner here, but to start with;
```
c=lambda a:'\n'.join(''.join(y or' 'for y in x).rstrip()for x in map(None,*a.split('\n')))
```
The code uses a simple `split` to split the string into a vector of rows. It then uses `map` with a function value as `None` (the unity function) and the splat operator to transpose and pad the vector (similar functionality to `zip_longest` in Python3)
The rest of the code just maps `None` to space, trims and reassembles the matrix to a single string again.
```
>>> a = 'I am a text.\nTranspose me.\nCan you do it?'
>>> c(a)                                                                            
'ITC\n ra\naan\nmn\n sy\napo\n ou\nts\need\nx o\ntm\n.ei\n .t\n  ?'
>>> len("""c=lambda a:'\n'.join(''.join(y or' 'for y in x).rstrip()for x in map(None,*a.split('\n')))""")
88
# (+2 since `\n` is considered by `len` to be a single char)
```
[Answer]
# Bash+coreutils+sed, 83
```
eval paste `sed 's/.*/<(fold -w1<<<"&")/'`|expand -t2|sed 's/\(.\) /\1/g;s/ \+$//'
```
`fold` and `paste` do the important work. The rest is just formatting.
Accepts input from stdin and outputs to stdout:
```
$ < tr.txt ./transposefile.sh
ITC
 ra
aan
mn
 sy
apo
 ou
ts
eed
x o
tm
.ei
 .t
  ?
$ < tr.txt ./transposefile.sh | ./transposefile.sh
I am a text.
Transpose me.?
Can you do it
$ 
```
[Answer]
**C (278 bytes)**
*Edit: This actually breaks the rules, since it takes a filename in as an argument but writes to stdout. I'll edit it later to write to a file and then print the filename to stdout.*
This is my first code golf ever, so have mercy. Some plain old C. Place the input in `test.txt` and let it run!
`clang transpose.c -o transpose && ./transpose test.txt`
```
#import <stdio.h>
#import <stdlib.h>
#import <string.h>
#define BUFFER_SIZE 1024
#define MAX(A,B) ((A)>(B)?(A):(B))
int main(int argc, char **argv) {
    char line[BUFFER_SIZE];
    FILE *f; int nLines, maxLen;
    f = fopen(argv[1], "r");
    while(!feof(f) && fgets(line, BUFFER_SIZE, f)) {
        nLines++;
        maxLen = MAX(maxLen, strlen(line));
    }
    fclose(f);
    for (int charPos = 0; charPos < maxLen; charPos++) {
        f = fopen(argv[1], "r");
        for (int linePos = 0; linePos < nLines; linePos++) {
            fgets(line, BUFFER_SIZE, f);
            printf("%c", charPos < strlen(line) && line[charPos] != '\xA' ? line[charPos] : ' ');
        }
        printf("\n");
        fclose(f);
    }
    return 0;
}
```
By using short variable names, removing gratuitous formatting, and allowing file handles to leak, and disabling all warnings this is reduced to 278 bytes. (Since this uses implicit imports, it may not link properly on all systems. Works on my machine!)
```
#import <stdio.h>
int main(int C,char**V){char L[1024];int A,B,D,I,J,*F=fopen(V[1],"r");while(!feof(F)&&fgets(L,1024,F)){A++;D=strlen(L);B=B>D?B:D;}for(I=0;I<B;I++){F=fopen(V[1],"r");for(J=0;J<A;J++)fgets(L,1024,F)&&printf("%c",I<strlen(L)&&L[I]!='\n'?L[I]:' ');printf("\n");}}
```
[Answer]
## AutoHotkey 210
```
f(i){
StringSplit,o,i,`n
m:=0
loop % o0 {
a:=A_index
if (t:=Strlen(p:=o%a%))>m
m:=t
StringSplit,l%a%,o%a%
}
loop % m {
a:=A_index,n:=""
loop % o0
n.=(j:=l%A_index%%a%)=""?" ":j
s.=Rtrim(n," ") "`n"
}
return s
}
```
### Test
```
text=
(
I am a text.
Transpose me.
Can you do it?
)
msgbox % f(text)
```
[Answer]
# Ruby: 88 characters
(Posted because it's shorter then the other Ruby solutions. Not checked whether my code introduces anything new compared to those. If you already posted a Ruby solution and you feel this is mostly a copy of yours, please comment and I will retire my answer.)
```
f=->t{l=t.split$/;r=[""]*m=l.map(&:size).max;l.map{|l|m.times{|i|r[i]+=l[i]||" "}};r*$/}
```
Sample run:
```
irb(main):001:0> f=->t{l=t.split$/;r=[""]*m=l.map(&:size).max;l.map{|l|m.times{|i|r[i]+=l[i]||" "}};r*$/}
=> #<Proc:0x99a9e68@(irb):1 (lambda)>
irb(main):002:0> sample='I am a text.
irb(main):003:0' Transpose me.
irb(main):004:0' Can you do it?'
=> "I am a text.\nTranspose me.\nCan you do it?"
irb(main):005:0> puts f[sample]
ITC
 ra
aan
mn
 sy
apo
 ou
ts
eed
x o
tm
.ei
 .t
  ?
=> nil
irb(main):006:0> puts f[f[sample]]
I am a text.
Transpose me.
Can you do it?
=> nil
```
[Answer]
# Bash, 124 bytes
```
D=`mktemp -d`;split -l1 - $D/;for F in $D/*;do grep -o . $F>$F+
done;paste $D/*+|sed -e's/\([^\t]\)\t/\1/g;s/\t/ /g;s/ *$//'
```
It reads standard input and writes standard output. Try it:
```
echo $'I am a text.\nTranspose me.\nCan you do it?' | script.sh
```
How it works:
* `split` input into single lines (files in temporary directory `$D`)
* split lines into single characters using `grep` (files \*+)
* layout characters side-by-side using `paste` (TAB-separated columns)
* remove alignment TABs, replace filler TABs with BLANKs, trim using `sed`
Edit:
* -9: Removed tidy-up code `;rm -r $D` (thanks Tim)
* -2: use `+` instead of `_` as suffix and shorten `${F}_` to `$F+`
* -3: remove prefix `L` from split result files
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 40 bytes
```
P`.+
~L0$`.
L,$.%'vs,$.(x$%=),`.+
m` *$
```
[**Try it online!**](https://tio.run/##K0otycxLNPz/PyBBT5urzsdAJUGPy0dHRU9VvawYSGlUqKjaauqAJHMTFLRUuP7/91RIzFVIVChJrSjR4wopSswrLsgvTlXITdXjck7MU6jML1VIyVfILLEHAA "Retina – Try It Online")
Based on [this program](https://tio.run/##K0otycxLNPz/390wgcs5gUtPm0tF25DLuSxBTw/C4VLy0VHRNikrBpJGOgl62kpxdQlcKgb//3sqJOYqJCqUpFaU6HHh5AAA) that I created to transpose any size of rectangle, which uses [Leo's suggestion](https://chat.stackexchange.com/transcript/message/43831903#43831903) for transposing a rectangle of a known size.
Edit: Golfed more and no longer has trailing spaces on lines.
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 6 bytes
```
y mx1R
```
[Try it](http://ethproductions.github.io/japt/?v=1.4.5&code=eSBteDFS&input=IkkgYW0gYSB0ZXh0LgpUcmFuc3Bvc2UgbWUuCkNhbiB5b3UgZG8gaXQ/Ig==)  
[Run it twice](http://ethproductions.github.io/japt/?v=1.4.5&code=eSBteDFSCnkgbXgxUg==&input=IkkgYW0gYSB0ZXh0LgpUcmFuc3Bvc2UgbWUuCkNhbiB5b3UgZG8gaXQ/Ig==) - returns original string
---
## Explanation
```
y
```
Transpose the input
```
m  R
```
Map over each line
```
x1
```
Trim right
[Answer]
### Ruby — 144 characters
Here's my first attempt, golfed:
```
def f t
t.split(?\n).each{|l|l<<' 'until l.size==t.split(?\n).map(&:size).max}.map{|x|x.split('')}.transpose.map{|l|l.join.rstrip}.join(?/n)
end
```
For output, run `puts f text` where `text` is any multi-line string adhering to the rules above. The ungolfed version is below:
```
def text_transpose(text)
  lines = text.split(?\n)
  maxlen = lines.map(&:size).max
  lines.each { |line| line << ' ' until line.size == maxlen }
       .map  { |line| line.split('') }.transpose
       .map  { |char| char.join.rstrip }.join(?\n)
end
```
For a similar, but ultimately better solution in Ruby, check out Wayne Conrad's code above.
[Answer]
**PHP 194**
```
function x($a){$a.="\n";$s=strlen($a);$i=0;while($c<$s)if($a{$c}!="\n")$b[$i++].=$a{$c++};else{$c++;for(;$i<$s;$i++)$b[$i].=" ";$i=0;}ksort($b);return rtrim(implode("\n",array_map("trim",$b)));}
```
Non-golfed:
```
function x($a) {
    $a.="\n";
    $s=strlen($a);
    $i=0;
    while($c<$s)
        if($a{$c}!="\n")
            $b[$i++].=$a{$c++};
        else{
            $c++;
            for(;$i<$s;$i++)
                $b[$i].=" ";$i=0;
        }
    ksort($b);
    return rtrim(implode("\n",array_map("trim",$b)));
}
```
This is my first golfing attempt, so please be kind! Also, tips/suggestions would be greatly appreciated!
[Answer]
## MATHEMATICA 117 chars
```
t = "I am a text.\nTranspose me.\nCan you do it?";
f=(m=Length/@(f=Flatten[Characters/@StringSplit[#,"\n"],{{2},{1}}])//Max;
StringJoin@@@(PadLeft[#,m," "]&/@f)//Column)&
```
[Answer]
# Perl (92+1)
reads stdin and writes to stdout. adding 1 to the score for `say`
```
@L=map[grep!/\n/,split//],<>;do{$_=join'',map shift@$_||$",@L;s/ +$//;say}while grep@$_>0,@L
```
[Answer]
# CJam, ~~32~~ 25 bytes
CJam is newer than this challenge, so this answer is not eligible for being accepted.
Considerably shortened by user23013.
```
qN/_z,f{Se]}z{S+e`);e~N}%
```
[Test it here.](http://cjam.aditsu.net/#code=qN%2F_z%2Cf%7BSe%5D%7Dz%7BS%2Be%60)%3Be~N%7D%25&input=I%20am%20at%20ext.%0ATranspo%20se%20me.%0ACan%20you%20%20do%20it%3F)
```
qN/                       "Read input, split into lines.";
   _z,                    "Transpose, get length (find maximum line length).";
      f{Se]}              "Pad each line to that length with spaces.";
            z             "Transpose.";
             {         }% "Map this block onto each line in the result.";
              S+          "Add a space to ensure there's at least one.";
                e`        "Run-length encode.";
                  );      "Discard the trailing run of spaces.";
                    e~    "Run-length decode";
                      N   "Push a newline.";
```
[Answer]
# Javascript, 103
```
s=>[...s].map((_,i)=>s.split`
`.map(b=>r+=b[q=b[i]||q,i]||' ',r=q='')&&r.replace(/ *$/,q?`
`:q)).join``
```
*Less golfed*
```
s=>[...s].map(
     // we need 'i' ranging from 0 to the length of the longest input line
     // so we scan all the input string, that is surely longer
     // but we need to check that after some point the output must be empty
     (_, i) => ( 
       r = '', // the current output row, starts empty
       q = '', // flag to check if we are beyond the longest line
       s.split('\n') // split in rows
       .map( 
         b => ( // for each input row in b
           q = b[i] || q, // if there is a char at position i in b, i goes to q
           r += b[i] || ' ' // add to output the char at position i or a fill space
         )
       ),
       q // if q is still '', we are beyond the longest input line 
       ? r.replace(/ *$/,`\n`) // trim leading space and add newline
       : '' // no output 
     )
   ).join('')
```
**Test**
```
F=
s=>[...s].map((_,i)=>s.split`
`.map(b=>r+=b[q=b[i]||q,i]||' ',r=q='')&&r.replace(/ *$/,q?`
`:q)).join``
function go() {
  var text=I.value
  var output = F(text)
  O.textContent = output
}
go()
```
```
#I { width:50%; height:5em }
```
```
<textarea id=I>I am a text.
Transpose me.
Can you do it?</textarea><br>
<button onclick='go()'>Transpose</button>
<pre id=O></pre>
```
[Answer]
## [Perl 5](https://www.perl.org/), 25 bytes
Note that this uses ANSI escape sequences and as such does not work on TIO, you can however [see it in action here](https://asciinema.org/a/eOM9VLfMu4qfsLECNNlSlBbQi).
```
$"="
[1D";$_="[1;$.H@F"
```
### Explanation
This code first changes the [list separator (`$"`)](https://perldoc.perl.org/perlvar.html#%24LIST_SEPARATOR) value to be a vertical tab, followed by the ANSI escape sequence for 'go backwards 1 column' (`\x1b[1D`), then we set the implicitly printed variable `$_` to be a string that starts with the ANSI escape sequence for 'start printing at line 1 column `$.` (where `$.` is the current line of text)' (`\x1b1;$.H`) and interpolates the list `@F` (which is a list of all the characters on that line, populated by autosplit (`-a`) with an empty split pattern (`-F`)) which places the contents of `$"` in between each item, moving the cursor vertically down instead of continuing output after the previous character.
[Try it online!](https://tio.run/##K0gtyjH9/19FyVaJWzra0EXJWiXeVgnIslbR83BwU/r/31MhMVchUaEktaJEjyukKDGvuCC/OFUhN1WPyzkxT6Eyv1QhJV8hs8T@X35BSWZ@XvF/3YLEHDcA "Perl 5 – Try It Online")
[Answer]
## C++ (243 characters)
Here's a function that takes and returns a string. 
I could've shaved a couple dozen chars, but decided to keep it as not-stupid code (runs fast, reads okay). Maybe I only decided to do that because this is my first code golf... I'm not hardcore enough yet :)
```
string f(string s){stringstream ss(s);vector<string> v;for(size_t i=0;getline(ss,s);++i){if(v.size() < s.size())v.resize(s.size());for(size_t j=0;j<s.size();++j){v[j].resize(i,' ');v[j].push_back(s[j]);}}s="";for(auto& i:v)s+=i+'\n';return s;}
```
With formatting:
```
string f(string s)
{
    stringstream ss(s);
    vector<string> v;
    for(size_t i = 0; getline(ss, s); ++i)
    {
        if(v.size() < s.size())
            v.resize(s.size());
        for(size_t j = 0; j < s.size(); ++j)
        {
            v[j].resize(i, ' ');
            v[j].push_back(s[j]);
        }
    }
    s = "";
    for(auto& i : v)
        s += i + '\n';
    return s;
}
```
[Answer]
Python 2.7 - **115 chars**:
oneliner:
```
>>> a
'I am a text.\nTranspose me.\nCan you do it?'
>>> "".join(["".join(i)+'\n' for i in zip(*[x+" "*(len(max(a.splitlines(), key=len))-len(x)) for x in a.splitlines()])])
'ITC\n ra\naan\nmn \n sy\napo\n ou\nts \need\nx o\ntm \n.ei\n .t\n  ?\n'
```
and in a cleaner printing:
```
>>> print "".join(["".join(i)+'\n' for i in zip(*[x+" "*(len(max(a.splitlines(), key=len))-len(x)) for x in a.splitlines()])])
ITC
 ra
aan
mn 
 sy
apo
 ou
ts 
eed
x o
tm 
.ei
 .t
  ?
```
**in 115 chars:**
```
>>> len(""""".join(["".join(i)+'\n' for i in zip(*[x+" "*(len(max(a.splitlines(), key=len))-len(x)) for x in a.splitlines()])])""")
115
```
[Answer]
## GolfScript, 51 chars
```
n%.{,}%$-1=" "*:y;{y+y,<}%zip{n\+0{;).32=}do}%((;\+
```
This is a first attempt; I suspect it can be improved. Most of the code is to comply with the padding and trailing space removal requirements — without them, just `n%zip n*` would suffice.
Ps. The following **46**-character version will do the job for the given sample input, but will crash if any input column consists entirely of spaces:
```
n%.{,}%$-1=" "*:y;{y+y,<}%zip{0{;).32=}do]}%n*
```
I assume that's enough to disqualify it, even if the challenge doesn't explicitly say so.
[Answer]
#  Scheme/Racket 113
The text:
```
(define t (list 
    (string->list "I am a text.") 
    (string->list "Transpose me.")
    (string->list "Can you do it?")
))
```
Without new lines and extra white spaces:
```
(define s(λ(v x)(if(= x 0)'()(cons(list->string(car v))(s(cdr v)(- x 1))))))(s(apply map list t)(length(car t)))
```
The user-friendly version
```
(define text (list 
    (string->list "I am a text.") 
    (string->list "Transpose me.")
    (string->list "Can you do it?")
))
(define transpose
    (λ(text length)
        (if (= length 0)
            '()
            (cons (list->string (car text)) (transpose (cdr text) (- length 1)))
)))
(transpose (apply map list text) (length (car text)))
```
[Answer]
## Haskell
```
import Data.List
main = interact (unlines . transpose . lines)
```
It was so short, I needed to add in white space...
[Answer]
Python ~~89~~ 103 chars
```
def f(a):return'\n'.join([''.join(i).rstrip()for i in zip(*[j+' '*99 for j in a.split('\n')])]).rstrip()
```
I feel dirty. ~~90~~ 104 chars for industrial strength version. :^)
[Answer]
# Mathematica, 95 chars
```
f=""<>Riffle[Thread@PadRight@Characters@StringSplit[#,"\n"]//.{0->" ",{x___," "..}:>{x}},"\n"]&
```
[Answer]
# K, 56
This should meet the spec now.
Accepts a string, returns a string. 
```
{`/:{$[" "=*|x;|(+/&\" "=|x)_|x;x]}'x@'/:!max@#:'x:`\:x}
```
.
```
k)f:{`/:{$[" "=*|x;|(+/&\" "=|x)_|x;x]}'x@'/:!max@#:'x:`\:x}
k)f"I am a text.\nTranspose me.\nCan you do it?"
"ITC\n ra\naan\nmn\n sy\napo\n ou\nts\need\nx o\ntm\n.ei\n .t\n  ?\n"
k)f f"I am a text.\nTranspose me.\nCan you do it?"
"I am a text.\nTranspose me.\nCan you do it?\n"
```
[Answer]
# Groovy, 98 chars
```
{i->o=[].withDefault{''};i.readLines().each{it.toList().eachWithIndex{c,d->o[d]+=c}};o.join('\n')}
```
[online](http://groovyconsole.appspot.com/script/5165882108018688)
ungolfed:
```
{i->
o=[].withDefault{''};//create list with empty string as default value 
i.readLines()
.each{
    it.toList() //split every line to characters
    .eachWithIndex{ 
        c,d->o[d]+=c //append to string from list with right index
    }
};
o.join('\n')}//join list with newlines
}
```
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 11 bytes
```
# aYcw1;.tY
```
[Try it online!](https://tio.run/##K6gsyfj/X1khMTK53NBaryTy/39PhcRchUSFktSKEj2ukKLEvOKC/OJUhdxUPS7nxDyFyvxShZR8hcwSewA "Pyth – Try It Online")
Takes input as a string, outputs a list of lists
# [Pyth](https://github.com/isaacg1/pyth), 25 bytes
```
# aYcw1=+Z1;jbcj"".n.tY)Z
```
Takes input as a string, outputs a string.
[Try it online!](https://tio.run/##K6gsyfj/X1khMTK53NBWO8rQOispOUtJSS9PryRSM@r/f0@FxFyFRIWS1IoSPa6QosS84oL84lSF3FQ9LufEPIXK/FKFlHyFzBJ7AA "Pyth – Try It Online")
[Answer]
# J, ~~28~~ 26 Bytes
Saved 2 bytes thanks to frownyfrog
```
t=.,@:(,&LF"1)@|:@:>@cutLF
```
Takes a string, returns a string. I'm not sure if there's a shorter version of the 'cutopen' ~~function~~ *verb* that I could use.
There's also the shorter
```
t=.|:@:>@cutLF
```
But I'm not sure it falls within the OP's guidelines, as it returns an array of characters.
### How it works:
```
                     cutLF   | Splits the input on new lines and boxes them
                    @        | Composes verbs (as does @:, but they're not equal)
                   >         | Unboxes this, forming an array of the lines
                 @:          |
               |:            | Transposes the array
      (      )@              |
       ,&LF                  | Appends a new line...
           "1                | To each row of the array
    @:                       |
   ,                         | Flatten the result
t=.                          | Assign this verb to t
```
The other version works the same, but doesn't convert the transposed array to a properly formatted string.
### Examples:
```
NB. Define a multi-line string
    text =: 0 : 0
I am a text.
Transpose me.
Can you do it?
)
    t text
ITC
 ra
aan
mn    NB. There's whitespace after the 'n' here, but I assume it doesn't count as trailing since it's part of the original string
 sy
apo
 ou
ts 
eed
x o
tm 
.ei
 .t
  ?
    t t text
I am a text.     NB. Again, whitespace here, but it's part of the argument of the second 't' (added by the first 't' to keep columns straight)
Transpose me. 
Can you do it?
```
[Answer]
# [Lua](https://www.lua.org), ~~203~~ 189 bytes
```
t={{}}i=1m=0(...):gsub(".",function(c)n=#t[i]if c=="\n"then i=i+1t[i]={}else t[i][n+1]=c end m=m<=n and n+1or m end)
for x=1,m do for p=1,i do io.write(t[p][x]or" ")end _=m<=x or print()end
```
[Try it online!](https://tio.run/##TU89T8MwEN3zK05hcdTUIhkRJwYmdjZjIZO69ERtR44TgqL89nCuWsFyfh@n93zn0WxbwmVZV8LG4b2QUlYPn8P4IUpZ1sfRd4mCF13l8S4p0nSEDrF882U6WQ@EtGuyjstqz4OFjJXfNRo7sP4ADt0jejAMWQ0RXJar4shwxqZ2cAiQSc@EMqEgvyMlK5LqtZp1iCWUVc56z1kz5OVIPoksbvu9Ulda3N6c91XDBMQ/7A3FQaSKswu4VFHLXvvPnK4m/JVPrZS5l1Vu4XnLZqb1tr2AcWAg2TnJ4jUaP/SBz3dWFs/Gw08YL7ekp18 "Lua – Try It Online")
I saw another Lua solution here, but I don't think there's a problem with posting 2 solutions on the same language. If there is, tell me :)
]