java - How to get properties without it being delimited? -


I am using commons-configuration v1.10 and I using class propertiesconfiguration I am in the properties of my applications; I have a property that has a comma, but when I read it, it becomes delimited, and I do not understand how to get it.

This property is included back and coma respectively, but the reason for this is because I get '[' and ']' around it.

Saran structure is a function, setDelimiterParsingDisabled () , which disables the demarcation, but I can not find any class that has it Implemented to read.

  Private static string readproperty (string property) {try {configuration configuration = new property synthesis (property files); Return configuration.getProperty (property) .toString (); } Grip (Configuration Exception e) {System.out.println ("Reading Point" + Property + "Properties"); E.printStackTrace (); System.exit (1); Return ""; }}    

Posting your code will help.

You want AbstractConfiguration.setListDelimiter (null) ;

You can also use the string methods to search and remove nearby [0] property as prop :

  int start = prop.indexOf ('['] + 1 is in a string; int end = prop.lastIndexOf (')'); String val = prop.bestring (start, end> ​​gt; end: prop.length ());   

indexOf returns -1 if the character is not found, then adding 1 to start the real property value is always working, even if the delimiter is not present Are not there.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -