U
U
UrbanTurizm2021-12-26 20:04:50
C++ / C#
UrbanTurizm, 2021-12-26 20:04:50

How to find out if there is a space after the delimiter?

Good afternoon everyone, there is such a CSV (txt) file

dialogue_O2uWK,I've spent too long away from my family... My contract is almost up and i'll finally be able to go home.,,Ma famille me manque. J'espère que je les verrai bientôt.,Mi manca la mia famiglia. Spero di rivederli presto.,,,,,"Я скучаю по семье. Надеюсь, я скоро их увижу.",家族に会いたい。早く会えることを願っている。,我想念我的家人。我希望能尽快见到他们。,,,Ailemi özledim. Umarım yakında görüşürüz.,,,


With such a division , the Strings fight not only at the separator, but also when the comma is "inside" the sentence, which is understandable, tell me how to avoid this and get a whole string, not paying attention to the commas inside it? That is, something like this: As I understand it, it is necessary to somehow check for the presence of a space after the comma, etc.? But I can’t figure out how. PS I'm really afraid this will not always work, because not everyone and not everywhere put a space after the comma. PPS Or is it still worth looking for a CSV parser and doing it through it? string[] list = sourceText.Split(',');
Я скучаю по семье. Надеюсь, я скоро их увижу.


Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nik Faraday, 2022-01-18
@NikFaraday

To split by a dot, use Split('.')
To check for a space after the comma, use a comma search through a loop (Better through for) and check if the element at index i+1 is a space.
Something like if (list[i + 1] == ' ') ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question