Displaying keyword search results 1 - 4
Created by Dr. Xi on June 21, 2011 15:41:51 Last update: June 22, 2011 11:33:36
Demo code for CSV parsing with Apache Commons CSV parser . Java code:
import java.io.*; import org.apache.commons.csv...Test with a simple CSV file:
psmith01,CLASS2B,Peter Smith 1,YEAR2,1,N,ADVANCED,...Result:
Line 1 has 11 values: |psmith01| |CLASS2B|...The parser worked correctly. Test with a more complicated CSV file:
"psmith01 abc", "CLASS2B " , " Peter...Result:
Line 1 has 4 values: |psmith01 abc| |CLASS...The third line is invalid input, but throwing a Java IOException is a bit grave. Also, the parser is not able to escape a backslash. Add a new line in item two:
"One", "Two ", "Three"Result:
Line 2 has 3 values: |One| |Two | |...
Created by Dr. Xi on August 03, 2010 16:23:55 Last update: October 22, 2010 15:35:20
According to Java documentation: The Java compiler and other Java tools can only process files which contain Latin-1 and/or Unicode-encoded (\udddd notation) characters. This utility converts a utf-8 encoded file to ascii with unicode escape strings for non-ascii characters.
import java.io.*; /** * Reads file in U...It is equivalent to:
native2ascii -encoding utf-8using the standard Java native2ascii utility.
Created by Dr. Xi on August 03, 2010 16:29:35 Last update: August 03, 2010 16:36:50
This utility converts unicode escape strings in a file to UTF-8 encoded. Suppose you received a properties file with contents like:
# @(#)codepoint_zh_CN.properties 1.4 05/09/27 #...You can use this utility to convert it to UTF-8 and view or edit.
import java.io.*; /** * Reads file with...This utility is equivalent to:
native2ascii -reverse -encoding utf-8using the standard Java native2ascii utility.
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 ( : )...