Displaying keyword search results 1 - 4
Created by alfa on July 15, 2011 13:25:45 Last update: July 15, 2011 13:25:45
Read the whole contents of a file into a String. It's better to read the whole file as bytes and convert to String than to read the file line by line and concatenate the lines.
String getFileContents(String fileName) throws...Using java.nio :
import java.io.FileInputStream; import java...
Created by Dr. Xi on January 08, 2010 03:53:37 Last update: January 08, 2010 03:54:56
This is an Ant custom task to merge Properties files I lifted from http://marc.info/?l=ant-user&m=106442688632164&w=2 , with some minor bug fixes. Example usage:
<taskdef name="mergeProperty" classname="ant.task....Implementation:
package ant.task.addon; import java.io.Buff...
Created by Dr. Xi on November 19, 2008 00:22:27 Last update: January 07, 2010 23:00:36
There is a open source project named [ini4j] for processing Windows .ini configuration files. However, I found it an overkill for my purposes. So here is my simple implementation of a .ini parser. It mimics the standard java.util.Properties class with enhancements to get and set properties by section name. There are only a few simple rules: Leading and trailing spaces are trimmed from section names, property names and property values. Section names are enclosed between [ and ] . Properties following a section header belong to that section Properties defined before the appearance of any section headers are considered global properties and should be set and get with no section names. You can use either equal sign ( = ) or colon ( : )...
Created by Dr. Xi on April 18, 2009 21:41:01 Last update: April 29, 2009 03:23:55
While Python is strongly typed and wouldn't allow you to concatenate string s with int s, it gladly compares strings to ints, with unexpected results:
>>> '09' + 10 Traceback (most recent call last)...Use the int function to convert string to int and the str function to convert int to string:
>>> int('10') 10 >>> str(10) '10' >>> ...To convert an array of strings:
>>> map(lambda x: int(x), ['1', '2', '3']) [1, ...