Spec-Zone.ru › Dart 2

dart:convert

LineSplitter class

A StreamTransformer that splits a String into individual lines.

A line is terminated by either:

  • a CR, carriage return: U+000D ('\r')
  • a LF, line feed (Unix line break): U+000A ('\n') or
  • a CR+LF sequence (DOS/Windows line break), and
  • a final non-empty line can be ended by the end of the input.

The resulting lines do not contain the line terminators.

Example:

const splitter = LineSplitter();
const sampleText =
    'Dart is: \r an object-oriented \n class-based \n garbage-collected '
    '\r\n language with C-style syntax \r\n';

final sampleTextLines = splitter.convert(sampleText);
for (var i = 0; i < sampleTextLines.length; i++) {
  print('$i: ${sampleTextLines[i]}');
}
// 0: Dart is:
// 1:  an object-oriented
// 2:  class-based
// 3:  garbage-collected
// 4:  language with C-style syntax
Inheritance
  • Object
  • StreamTransformerBase<String, String>
  • LineSplitter

Constructors

LineSplitter()
const

Properties

hashCode → int
read-onlyinherited
The hash code for this object.
runtimeType → Type
read-onlyinherited
A representation of the runtime type of the object.

Methods

bind(Stream<String> stream) → Stream<String>
override
Transforms the provided stream.
cast<RS, RT>() → StreamTransformer<RS, RT>
inherited
Provides a StreamTransformer<RS, RT> view of this stream transformer.
convert(String data) → List<String>
noSuchMethod(Invocation invocation) → dynamic
inherited
Invoked when a non-existent method or property is accessed.
startChunkedConversion(Sink<String> sink) → StringConversionSink
toString() → String
inherited
A string representation of this object.

Operators

operator ==(Object other) → bool
inherited
The equality operator.

Static Methods

split(String lines, [int start = 0, int? end]) → Iterable<String>
Split lines into individual lines.

© 2012 the Dart project authors
Licensed under the BSD 3-Clause "New" or "Revised" License.
https://api.dart.dev/stable/2.19.6/dart-convert/LineSplitter-class.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API