Discussion:
[dart-misc] How to add formatted String into List or Array?
Niyazi Toros
2018-07-16 08:16:29 UTC
Permalink
Hi,


I have an incoming socket data as shown below;


*Example-1:*

1#.#4#.#B#.#175.52#.#USD#.#Currency


*Example-2: *

2#.#4#.#MyName#.#MySurname#.#MyCity#.#MyCountry#.#YourName#.#YourSurname#.#YourCity#.#YourCountry



Explanation for Example-1:

Separator: #.#

Column_count: 4

Rows_count: 1


Col1 Col2 Col3 Col4

Row-1: B 175.52 USD Currency



Explanation for Example-2:

Separator: #.#

Column_count: 4

Rows_count: 2


Col1 Col2 Col3 Col4

Row-1: MyName MySurname MyCity MyCountry

Row-2: YourName. YourSurname YourCity YourCountry




In dart (or flutter) how can I add this into List or Array? What is the
best practice?

How can I irritate incoming string use split function and add some array?


Any help please?
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/1d40fb3f-802a-4c0e-bfbb-96c34e4a4326%40dartlang.org.
Istvan Soos
2018-07-16 08:26:18 UTC
Permalink
I think you are looking for String.split:
https://api.dartlang.org/stable/1.24.3/dart-core/String/split.html

Istvan
Post by Niyazi Toros
Hi,
I have an incoming socket data as shown below;
1#.#4#.#B#.#175.52#.#USD#.#Currency
2#.#4#.#MyName#.#MySurname#.#MyCity#.#MyCountry#.#YourName#.#YourSurname#.#YourCity#.#YourCountry
Separator: #.#
Column_count: 4
Rows_count: 1
Col1 Col2 Col3 Col4
Row-1: B 175.52 USD Currency
Separator: #.#
Column_count: 4
Rows_count: 2
Col1 Col2 Col3 Col4
Row-1: MyName MySurname MyCity MyCountry
Row-2: YourName. YourSurname YourCity YourCountry
In dart (or flutter) how can I add this into List or Array? What is the best
practice?
How can I irritate incoming string use split function and add some array?
Any help please?
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/a/dartlang.org/d/msgid/misc/1d40fb3f-802a-4c0e-bfbb-96c34e4a4326%40dartlang.org.
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/CALdQGgurTkzhOHacqhHXKLU7zLiWK3n%2ByYEHHod_vZvkMBgNZA%40mail.gmail.com.
Niyazi Toros
2018-07-16 08:43:27 UTC
Permalink
Thanks Istvan, I know that.

My problem is that I need to add the string in like table, array or map, so
I can save it to device and use it later.
How can achieve this?

main() {
String mText = "1#.#4#.#B#.#175.52#.#USD#.#Currency";
List<String> mData = mText.split("#.#");
print(mData.toString());
// The List: [1, 4, B, 175.52, USD, Currency]
}
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/1811aa28-eeb4-41f0-8f0d-f12545f17e26%40dartlang.org.
Istvan Soos
2018-07-16 09:07:25 UTC
Permalink
This is overly vague, let's narrow it a bit. Are you looking for
storing it in a file or a database? What platform are you developing
for (e.g. server, flutter, web)?

Istvan
Post by Niyazi Toros
Thanks Istvan, I know that.
My problem is that I need to add the string in like table, array or map, so
I can save it to device and use it later.
How can achieve this?
main() {
String mText = "1#.#4#.#B#.#175.52#.#USD#.#Currency";
List<String> mData = mText.split("#.#");
print(mData.toString());
// The List: [1, 4, B, 175.52, USD, Currency]
}
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/a/dartlang.org/d/msgid/misc/1811aa28-eeb4-41f0-8f0d-f12545f17e26%40dartlang.org.
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/CALdQGgs7fBDMGrkYv5rO7HCkoDvyUufjoqMZXf-cX7Dw0SiAvg%40mail.gmail.com.
Niyazi Toros
2018-07-16 09:16:59 UTC
Permalink
Thanks,
I am going to use in Flutter. The incoming socket data is not change so
often. But I am planing to run in every 10 days.
And I am planing to store the data in (local database) sqflite or shared_preferences.
But I am still looking the best practice.
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/39f3596a-cc89-4751-b5c9-ca79f4c570a7%40dartlang.org.
Loading...