2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.config.yangjmxgenerator.plugin.util;
10 import java.util.Scanner;
12 public class FormattingUtil {
14 public static String cleanUpEmptyLinesAndIndent(String input) {
15 StringBuffer output = new StringBuffer();
16 Scanner scanner = new Scanner(input);
17 while (scanner.hasNextLine()) {
18 String line = scanner.nextLine();
19 line = line.replaceAll("\t", " ");
20 while (line.contains(" ")) {
21 line = line.replaceAll(" ", " ");
24 if (line.length() > 0) {
30 return output.toString();