Add EntryHeader::read_with_sep() which allows seperator modification
This commit is contained in:
parent
a4fa1bac07
commit
bca0143343
1 changed files with 5 additions and 1 deletions
|
@ -581,7 +581,11 @@ impl EntryHeader {
|
||||||
* larger than the array length.
|
* larger than the array length.
|
||||||
*/
|
*/
|
||||||
pub fn read(&self, spec: &str) -> Result<Option<Value>> {
|
pub fn read(&self, spec: &str) -> Result<Option<Value>> {
|
||||||
let tokens = EntryHeader::tokenize(spec, '.');
|
self.read_with_sep(spec, '.')
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn read_with_sep(&self, spec: &str, splitchr: char) -> Result<Option<Value>> {
|
||||||
|
let tokens = EntryHeader::tokenize(spec, splitchr);
|
||||||
if tokens.is_err() { // return parser error if any
|
if tokens.is_err() { // return parser error if any
|
||||||
return Err(tokens.err().unwrap());
|
return Err(tokens.err().unwrap());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue