Working with large text snippets in Java source

后端 未结 3 941
夕颜
夕颜 2020-12-17 09:45

Are there any good ways to work with blocks of text (Strings) within Java source code? Many other languages have heredoc syntax available to them, but Java does not. This ma

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-17 09:57

    The closes option in Java to HereDoc is java.text.MessageFormat. You can not embed logic. It a simple value escape utility. There are no variables used. You have to use zero based indexing. Just follow the javadoc.

    http://download.oracle.com/javase/1,5.0/docs/api/java/text/MessageFormat.html

提交回复
热议问题