Hi
In below code i want to extract values in 2 separate strings
htts://nimubs-assets.s3.amazonaws.com/manifest/20221227113803-73.pdf
1 - htps://nimubs-assets.s3.amazonaws.com/manifest/
2 - 20221227113803-73.pdf
Thanks
Hi
In below code i want to extract values in 2 separate strings
htts://nimubs-assets.s3.amazonaws.com/manifest/20221227113803-73.pdf
1 - htps://nimubs-assets.s3.amazonaws.com/manifest/
2 - 20221227113803-73.pdf
Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Jignesh KumarRank #91 · 22.9K reputationPosted Dec 27, 2022, 3:33 AM EST
string s = "htts://nimubs-assets.s3.amazonaws.com/manifest/20221227113803-73.pdf"; int idx = s.LastIndexOf('/'); if (idx != -1) { var firstPart = s.Substring(0, idx); // htts://nimubs-assets.s3.amazonaws.com/manifest var secondPart = s.Substring(idx + 1); // 20221227113803-73.pdf }Vishal JoshiRank #377 · 6.7K reputationPosted Dec 27, 2022, 3:28 AM EST
Hello
You can try the below code to get the expected result.
string strPath = "c://myfiles//ref//file1.txt"; //function call to get the filename filename = Path.GetFileName(strPath); //function call to get the directory name directoryName = Path.GetDirectoryName(strPath);Thanks