.properties⽂件的格式
1.说明: 这种⽂件需要有⼀定的格式才能被java.util.Properties包读取。主要⽤在java相关的技术上,⽤来存储应⽤的可配置参数。
每个实体都占⼀⾏,有如下两种格式。两个字符串参数,左边是键,右边是值。
1)propertyName=propertyValue
2)propertyName:propertyValue
在键与值之间的空格会被忽略。下⾯两个是等效的。
name=Stephen
name = Stephen
且在每⼀⾏的开始部分空格也会被忽略。
properties是什么文件注释⽤ # 号或 ! 号开始,会被忽略。且空⽩⾏也会被忽略。
值⼀般会处于⾏的末尾部分,末尾如有空格,也包括在值⾥。
续⾏符,\ + 换⾏符elasticsearch性能
message = Welcome to \
Wikipedia!
等同于 message = Welcome to Wikipedia!
注意:每⼀⾏的开始部分空格也会被忽略
转义字符,\ \表⽰\,\n表⽰换⾏,\r 表⽰carriage return,\t表⽰tabpython 字符串 split
使⽤Unicode,\u开头,⽐如,\u002c
2.例⼦: CSDN不⽀持properties格式代码块,我⽤Typora软件编辑markdown的话⽀持。
# You are reading the ".properties" entry.
! The exclamation mark can also mark text as comments.
# The key characters =, and : should be written with
数据库原理及应用sql server2012答案
# a preceding backslash to ensure that they are properly loaded.
laravel和yii哪个用的多m# However, there is no need to precede the value characters =, and : by a backslash.
website = /
language = English
# The backslash below tells the application to continue reading
# the value onto the next line.
message = Welcome to \
Wikipedia!第一ppt课件免费下载网
# But if the number of backslashes at the end of the line is even, the next line is not included in the value. In the following example, the value for "key" is "v alueOverOneLine\"
key = valueOverOneLine\\
# This line is not included in the value for "key"
# Add spaces to the key
key\ with\ spaces = This is the value that could be looked up with the key "key with spaces".
# The characters = and : in the key must be escaped as well:
key\:with\=colonAndEqualsSign = This is the value for the key "key:with=colonAndEqualsSign"
# Unicode
tab : \u0009
# If you want your property to include a backslash, it should be escaped by another backslash
path=c:\\wiki\\templates
# However, some editors will handle this automatically

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。