(refs #445)Keep line separator in online file editing

This commit is contained in:
Naoki Takezoe
2014-07-26 23:15:47 +09:00
parent 0822b7b5f3
commit 34e299bf52
4 changed files with 37 additions and 11 deletions

View File

@@ -46,6 +46,22 @@ object StringUtil {
}
}
/**
* Converts line separator in the given content.
*
* @param content the content
* @param lineSeparator "LF" or "CRLF"
* @return the converted content
*/
def convertLineSeparator(content: String, lineSeparator: String): String = {
val lf = content.replaceAll("¥r¥n", "¥n").replaceAll("¥r", "¥n")
if(lineSeparator == "CRLF"){
lf.replaceAll("¥n", "¥r¥n")
} else {
lf
}
}
/**
* Extract issue id like ```#issueId``` from the given message.
*