New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with parsing CSV file with spaces and colon #80
Comments
Hi, @Phalaen. Thank you for your feedback.
|
Dear @doyaaaaaken, import android.os.Build class MainActivity : AppCompatActivity() {
button.setOnClickListener { lifecycleScope.launch(Dispatchers.IO){
} // extension function to get string data from url data class DataClass( fun parse(data:InputStream): List?{
} In R.layout.activity_main there is only a button ("button") and a textview ("textView"). |
@Phalaen Hint: You can convert InputStream into String by using the below code.
|
Dear @doyaaaaaken , Device serial,Date ,Rainfall 10 (Accumulated) mm Is it normal? This never happened before to me |
Solved! |
Good morning,
I'm trying to use kotlin-csv on a comma delimited file (input stream) but I think there is a problem with managing the spaces and colon.
In particular, these are the first lines of the file:
Device serial,Date ,Temperature 51 (Medium) °C
11869,2021-02-09 00:14:59,7.2
11869,2021-02-09 00:30:01,7.1
11869,2021-02-09 00:44:59,7.2
11869,2021-02-09 00:59:59,7.4
11869,2021-02-09 01:14:58,7.5
11869,2021-02-09 01:29:58,7.5
11869,2021-02-09 01:44:58,7.3
11869,2021-02-09 01:59:58,7.2
11869,2021-02-09 02:14:58,7.2
11869,2021-02-09 02:29:58,7.2
11869,2021-02-09 02:44:58,7.2
11869,2021-02-09 02:59:57,7.3
11869,2021-02-09 03:14:57,7.2
11869,2021-02-09 03:29:57,7.3
11869,2021-02-09 03:44:57,7.2
11869,2021-02-09 03:59:57,7.4
..while this is the script:
data class DataClass(
val FirstColumn: String,
val SecondColumn: String,
val ThirdColumn: String )
fun parse(data:InputStream): List?{
}
catch (e: Exception) {
e.printStackTrace()
}
return list
}
Unfortunately only the first column of each row is correctly identified in the output, for example (first row):
first column: 11869
second column: 2021-02-09
third colum: 0
No other colums detected.
Where is my mistake?
Thank you
The text was updated successfully, but these errors were encountered: