I want to split some string and to contain each line in separate element in array. I use this code for reaching my goal:
List _masForUsing;
_masForUsing = new List(numberOfLines);
void gpsHelper(String text, int count){
for(int i =0; i<count;i++){
_masForUsing[i] = text.split("\\r?\\n");
}
print(_masForUsing[2]);
}
But when I am truying to evoke the third element of array, it just show full my string. Please help, me :)
This is example of String:
real time: 23-09-2019, 23:08:55, Mon system time: 5362 gps coordinates: 55.376538; 037.431973; gps satellites: 3; gps time: 20:09:02; gps date: 23.09.19; temperature: 19 *C humidity: 35 % dust: 1 zivert: 21
splitargument is a string, but you are expecting it to be a regular expression. It doesn't match because your string does not contain the five-letter substring "BACKSLASH r QUESTIONMARK BACKSLASH n". To use it as a RegExp, you have to writetext.split(RegExp("\\r?\\n"))(or, more readable:text.split(RegExp(r"\r?\n"))using a raw string). Or use the availableStringSplitteras recommended below.