Java String Indent Format indent(String s)

Here you can find the source of indent(String s)

Description

indent

License

Apache License

Declaration

public static String indent(String s) 

Method Source Code

//package com.java2s;
/*//from   ww  w  .ja v  a  2 s.  com
 appinventor-java-translation

 Originally authored by Joshua Swank at the University of Alabama
 Work supported in part by NSF award #0702764 and a Google 2011 CS4HS award

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

public class Main {
    public static String indent(String s) {
        return new StringBuilder(s.replaceAll("\n", "\n\t"))
                .insert(0, "\t").toString();
    }
}

Related

  1. indent(String lines, String indentation)
  2. indent(String message, int indent)
  3. indent(String msg, int size)
  4. indent(String original, int spaces)
  5. indent(String s)
  6. indent(String s)
  7. indent(String s)
  8. indent(String s, int numBlanks)
  9. indent(String str)