how to read property name with spaces in java

后端 未结 4 751
甜味超标
甜味超标 2020-12-18 20:04

I am trying to load all the property names present in the properties file using the below code:

for(Enumeration en = (Enumeration         


        
4条回答
  •  醉话见心
    2020-12-18 20:25

    You can escape the spaces in your properties file, but I think it will start to look pretty ugly.

    username=a
    password=b
    Parent\ file\ name=c
    Child\ file\ name=d
    

    You might be better of writing your own implementation with split() or indexOf() or whatever your heart desires to avoid any future bugs and/or headaches.

提交回复
热议问题