Here you can find the source of filterEnter(String str)
Parameter | Description |
---|---|
str | a parameter |
public static String filterEnter(String str)
//package com.java2s; public class Main { /**/*from w ww . j ava 2s .com*/ * @author : tiankang * @param str * @return */ public static String filterEnter(String str) { int ind; StringBuffer sb = new StringBuffer(); while ((ind = str.lastIndexOf("\n")) != -1) { sb.append(str.substring(0, ind)); sb.append("\\n"); sb.append(str.substring(ind + 1)); str = sb.toString(); sb.delete(0, str.length()); } return str; } }