public class SScanf extends ScanfReader implements Iterator<Object>
Constructor and Description |
---|
SScanf(String theString,
String format)
creates a scanf reader for a given string and format and returns the approriate object
valid format identifiers %f - returns Double %i - returns Integer %d - returns Integer %x - returns Integer %o -
returns Integer %c - returns String %s - returns String
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext() |
Object |
next()
returns the next Object (@see the constructor), null if the string has been completely parsed or an invalid
format is scanned
|
void |
remove()
NOT IMPLEMENTED - the iterator is only forward
|
double |
scanDouble(ScanfFormat fmt)
Scan and return a double, using a pre-allocated ScanfFormat object.
|
String |
scanString(ScanfFormat fmt)
Scan and return a String, using a pre-allocated ScanfFormat object.
|
Vector<Object> |
sscanf()
scan a string using C++ sscanf functionality
|
static Vector<Object> |
sscanf(String theString,
String format)
convenience static function - see the constructor for details
|
clearLookAheadChar, close, getCharNumber, getLineNumber, getLookAheadChar, lookAheadCharValid, read, scanChar, scanChar, scanChar, scanChars, scanChars, scanChars, scanDec, scanDec, scanDec, scanDouble, scanDouble, scanFloat, scanFloat, scanFloat, scanHex, scanHex, scanHex, scanInt, scanInt, scanInt, scanLong, scanLong, scanLong, scanOct, scanOct, scanOct, scanString, scanString, setCharNumber, setLineNumber, useCstandard, useCstandard
mark, markSupported, read, read, read, ready, reset, skip
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
public SScanf(String theString, String format)
theString
- the String to scanformat
- the formatting String to apply according to c++ sscanf roolspublic double scanDouble(ScanfFormat fmt) throws IOException, ScanfMatchException, IllegalArgumentException
ScanfReader
scanDouble
in class ScanfReader
fmt
- Format objectScanfMatchException
- Input did not match formatEOFException
- End of fileIOException
- Other input errorIllegalArgumentException
- Error in format specificationorg.cip4.jdflib.cformat.ScanfReader#scanDouble(org.cip4.jdflib.cformat .ScanfFormat)
public String scanString(ScanfFormat fmt) throws IOException, IllegalArgumentException
ScanfReader
scanString
in class ScanfReader
fmt
- Format objectScanfMatchException
- Input did not match formatEOFException
- End of fileIOException
- Other input errorIllegalArgumentException
- Error in format specificationorg.cip4.jdflib.cformat.ScanfReader#scanString(org.cip4.jdflib.cformat .ScanfFormat)
public boolean hasNext()
hasNext
in interface Iterator<Object>
Iterator.hasNext()
public Object next()
public void remove()
remove
in interface Iterator<Object>
Iterator.remove()
Copyright © 2018. All rights reserved.