Space padding to String in Android

/* Note: 1. - sign will do right padding. 2. default it will do left paddnig. */ private String rightSpacePadding(String input) { String output = input; output = String.format("%1$" + (-25)+ "s", output); return output; } private String leftSpacePadding(String input) { String output = input; output = String.format("%1$" + 25 + "s", output); return output; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.