1
I have a string _Users
of the kind List
, it contains several lines.
Each line consists of an integer and a string separated by comma (in general it is only one string): ID (numbers only),name (letters and numbers).
What I’m trying to do is find out which line the ID is located on.
If I want to find the index of ID 1, the function Contains()
will return me the first line containing "1", it will disturb if there is a user with name, for example: "joao123".
int i = _Users.FindIndex(a => a.Contains(UserID.ToString()));
var dados = _Users[i];
string[] dado = dados.Split(',');
Did any of the answers solve your question? Do you think you can accept one of them? Check out the [tour] how to do this, if you haven’t already. You would help the community by identifying what was the best solution for you. You can accept only one of them. But you can vote on any question or answer you find useful on the entire site (when you have enough score).
– Maniero