RSS feed [root] /string /weblog /java




login:

password:

title search:




 


Thu Feb 16 00:04:35 HKT 2017

string



(google search) (amazon search)
second
download zip of files only

Thu Feb 16 00:05:43 HKT 2017 From /weblog/java/string

regex


Introduction to a library which support faster regular expression processing: http://weblogs.java.net[..]ite/archive/2006/03/a_faster_java_r.html http://www.javaadvent.com[..]-expression-library-benchmarks-2015.html

Regex helper - https://github.com/VerbalExpressions/JavaVerbalExpressions

(google search) (amazon search)


Wed Jul 23 09:57:03 HKT 2014 From /weblog/java/string

comparison


Better sorting should do 2 things:
1) case insensitive
2) aware of numbers in the file names. So File2 comes after File1 (obviously) but before File10

http://jroller.com[..]ingcomparator_sorting_strings_for_people

source: http://jroller.com/resources/t/tfenne/HumaneStringComparator.java

Switch comparison - http://java-performance.info/string-switch-performance/

(google search) (amazon search)


Mon Dec 02 11:47:12 HKT 2013 From /weblog/java/string

unicode


A common issue of Windows environment and the workaround - http://jroller.com/page/ff?entry=java_utf_8_bug_grief

Strange String issues in JVM languages, don't trust all string operations all the time! https://sites.google.com[..]/posts/strangestringissuesinjvmlanguages http://mortoray.com/2013/11/27/the-string-type-is-broken/

(google search) (amazon search)


Fri Nov 22 17:04:49 HKT 2013 From /weblog/java/string

alignment


Discussion of how to do string alignment - http://manycupsofcoffee.blogspot.com.au[..]va-implementation-of-optimal-string.html

(google search) (amazon search)


Tue Nov 19 17:19:59 HKT 2013 From /weblog/java/string

intern


String.intern() is designed for constant strings, it's implemented in C/C++ in the hotspot core code, and it has a fixed-size hashmap of around 20K entries and if more than this number of strings are interned, the performance degrades linearly since there are hash collisions and the code has to search down linked lists.

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6988220

String.intern in Java 7 and 8 - http://java-performance.info/string-intern-in-java-6-7-8/ http://java-performance.info[..]-intern-java-6-7-8-multithreaded-access/ http://java-performance.info/string-intern-java-7-8-part-3/

(google search) (amazon search)


Tue Feb 07 18:56:48 HKT 2006 From /weblog/java/string

toString


Nice and simple toString():

public String toString() {

return MyClass.class.getSimpleName()

+ new LinkedHashMap() {{

put("foo", foo);

put("bar", bar);

put("tee", tee);

}};

}

Results in:

MyClass[foo: fooValue, bar: barValue, tee: teeValue]

http://crazybob.org/2006/02/simple-tostring-hack.html

(google search) (amazon search)


Tue Nov 08 18:35:42 HKT 2005 From /weblog/java/string

string length


Surprisingly, String length more complicate than we excepted. A char is not necessarily a complete character, so if you need to know the character length, you need to use codePointCount method

int charLen = myString.length();
int characterLen = myString.codePointCount(0, charLen);

However, if you use UTF-8 encoding, string.length() will work as expected.

More detail see:
http://forum.java.sun.com/thread.jspa?threadID=671720

(google search) (amazon search)