Java tutorial
//package com.java2s; public class Main { public static String getVerticalText(String text) { StringBuffer stringBuffer = new StringBuffer(); if (text != null && text.length() > 0) { int length = text.length(); for (int i = 0; i < length; i++) stringBuffer.append(text.charAt(i) + "\n"); } stringBuffer.deleteCharAt(stringBuffer.lastIndexOf("\n")); return stringBuffer.toString(); } }