edu.tum.cs.commons.string
Class LineSplitter
java.lang.Object
edu.tum.cs.commons.string.LineSplitter
public class LineSplitter
- extends Object
This class is used to split a string in lines.
Note: According to tests I performed this is the fastest method to
split a string. It is about nine times faster than the regex-bases split
with:
Pattern pattern = Pattern.compile("\r\n|\r|\n");
pattern.split(content);
- Version:
- $Revision: 26268 $
- Author:
- Florian Deissenboeck, $Author: juergens $
- Rating:
- GREEN Hash: F99C8B9E8F156988EBFA29796D5D1AEF
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LineSplitter
public LineSplitter()
setContent
public void setContent(String content)
- Set the string to split.
- Parameters:
content - the string to split. if string is null or the
empty string, getNextLine() will return
null
getNextLine
public String getNextLine()
- Obtain next identified line.
- Returns:
null if all lines were returned. On returning the
last line all references to the input string are deleted. So it
is free for garbage collection.
TUM CCSM Commons - 2.7