2
Good morning, everyone,
I am trying to pick up a specific part of a string in Visual Studio, in which case the string in question is a directory path: "C: Users User File-2018.txt" I would like to try to pick up only what comes after the last " ", I tried to do
string[] texto = caminho.Split("\");
string resultado = texto[3];
But the error code, saying that it cannot convert character to string, could anyone help me in this situation by honeycomb? I thank you in advance. Obs: "path" variable is string type
Wesley, your logic is right, but change
Split("\");
forSplit('\');
. In other words, change double quotes to single quotes.– Matheus Miranda
Hello Matheus, thank you for the reply, as it turned out I managed to settle with a solution down there. I thank you again for your reply.
– Q.Wesley
You need to understand why your code doesn’t work.
– Matheus Miranda