I have shared the relevant image below.
Text in image ;
"C:UsersHpOneDrive-blablablablaMasaustuEdaGorsel4.PNGtmanagertmanagert2022/12/12rndddtV1.0"
2.I should not use special names or filenames
3.Ex: t between like this
I hope I was able to explain my problem
3
you could use a Regex match to get this part of the url :
private Regex _regex = new Regex(@"^.*\(?<Image>.*.PNG)\.*$");
(You can test regex here)
Then use this to read the match :
var result = _regex.Match(url).Groups["Image"].Value;
Another, simplier solution, would be to use :
url.Split("\")[6];
This works only if the searched part is always at the same spot.
there is sevral ways
if you know number of "" in your string then split it(str.Split(‘ ‘)) and get wanted index
use regular expersion to extract filename
You can split your strings into many shorter ones using .Split function:
string[] words = path.Split("\");
Using the double to escape the character..
If you don’t guarantee that the string you need is always at the same position, you can use this to fetch it from the list:
string neededString = words .FirstOrDefault(str => str.Contains(".PNG"));
This will return the first instance of any word from your string that contains ".png" in it.
Click here to cancel reply.
3
Answers
you could use a Regex match to get this part of the url :
(You can test regex here)
Then use this to read the match :
Another, simplier solution, would be to use :
This works only if the searched part is always at the same spot.
there is sevral ways
if you know number of "" in your string then split it(str.Split(‘ ‘)) and get wanted index
use regular expersion to extract filename
You can split your strings into many shorter ones using .Split function:
Using the double to escape the character..
If you don’t guarantee that the string you need is always at the same position, you can use this to fetch it from the list:
This will return the first instance of any word from your string that contains ".png" in it.