SporkApp Source Code

( <-- Back to SporkApp )

Title:"Text Transposer"
Author:Sporkman
Last updated:
10/01/11  12:19 pm

Source code:


print("This tool will rearrange your rows of text into columns.\n\n");

print("Enter text to transpose:\n\n");

input txt_inp = print_input_textbox(60,20,"");

print("\n\n");

print_input_button("Transpose text");

load_user_input();

print("Result:\n\n\n");

string txt = get_input_value(txt_inp);

array string lines;

split(txt,lines,"\n");

int i, j, max_len;

for ( i=0, max_len=0; i<size(lines); ++i )
{
   if ( length(lines[i])>max_len )
   {
      max_len = length(lines[i]);
   }
}

for ( j=0; j<max_len; ++j )
{
   for ( i=0; i<size(lines); ++i )
   {
      if ( j<length(lines[i]) )
      {
         print(get_char(lines[i],j));
      }
      else
      {
         print(" ");
      }
      print("    ");
   }
   print("\n");
}







sporkforge