A single CSV record stored as valid UTF-8 bytes.
A Record permits reading or writing CSV records that are valid UTF-8. If Records are used to read CSV data that is not valid UTF-8, then the CSV reader will return an invalid UTF-8 error.
Methods
[src]
pub fn new(fields: ..string): Record {
return _csv.Record.from_array(fields) as Record;
}
Create a new empty record.
[src]
pub fn new(fields: ..string): Record {
return _csv.Record.from_array(fields) as Record;
}
Create a new empty record.
Create a new empty record.
nv
use csv.Record;
let record = Record.new();
assert_eq record.len(), 0;
let record = Record.new("hello", "world", "foo");
assert_eq record.len(), 3;
assert_eq record.get(0), "hello";
assert_eq record.get(1), "world";
assert_eq record.get(2), "foo";
from_array
pub fn from_array(fields: [string]): Record
[src]
pub fn from_array(fields: [string]): Record {
return _csv.Record.from_array(fields) as Record;
}
Create a new record from an array of fields.
from_array
pub fn from_array(fields: [string]): Record
[src]
pub fn from_array(fields: [string]): Record {
return _csv.Record.from_array(fields) as Record;
}
Create a new record from an array of fields.
Create a new record from an array of fields.
[src]
pub fn get(self, col: int): string? {
return (self as _csv.Record).get(col);
}
Return the field at index (zero-based) col in string.
[src]
pub fn get(self, col: int): string? {
return (self as _csv.Record).get(col);
}
Return the field at index (zero-based) col in string.
Return the field at index (zero-based) col in string.
If no field at index exists, then this returns nil
.
nv
use csv.Record;
let record = Record.new("1", "Alice", "1");
assert_eq record.get(0), "1";
assert_eq record.get(1), "Alice";
assert_eq record.get(2), "1";
assert_eq record.get(3), nil;
[src]
pub fn is_empty(self): bool {
return (self as _csv.Record).is_empty();
}
Return true
if the record is empty.
[src]
pub fn is_empty(self): bool {
return (self as _csv.Record).is_empty();
}
Return true
if the record is empty.
Return true
if the record is empty.
nv
use csv.Record;
let record = Record.new();
assert record.is_empty();