Java String Whitespace Clean cleanWhitespace(String definition)

Here you can find the source of cleanWhitespace(String definition)

Description

Helper method to make definition strings more Tab-delimited/Excel friendly

License

Apache License

Declaration

public static String cleanWhitespace(String definition) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /** Helper method to make definition strings more Tab-delimited/Excel friendly **/
    public static String cleanWhitespace(String definition) {
        if (definition == null) {
            return "NULL";
        }//from  w ww  .  ja  va 2s.c  om
        //      return definition.replace("\r", "[CR]").replace("\n", "[LF]").replace("\t", "[TAB]").replace(" ", "[SP]").trim();
        return definition.replace("\r", "[CR]").replace("\n", "[LF]").replace("\t", "[TAB]").trim();
    }
}

Related

  1. cleanWhitespace(String in)
  2. cleanWhiteSpace(String s, boolean all)
  3. cleanWhitespace(String str)
  4. cleanWhitespace(String string)