AnswerBun.com

How to cut a string to the first "/" from right to left c# .net

Stack Overflow Asked by Ignacio Gomez on August 1, 2020

I need to remove from my string the last section from the ""

          Input: C:qaweb2094Sitedasdasd.pdf
Expected Output: C:qaweb2094Site

One Answer

You can try the below code

string s = "C:\qaweb2094\Site\dasdasd.pdf";
if (s.Contains("\"))
{
    s = s.Substring(0, s.LastIndexOf("\"));
}

Correct answer by Sowmyadhar Gourishetty on August 1, 2020

Add your own answers!

Related Questions

How to convet this data to array?(Typescript )

1  Asked on December 23, 2021 by pyarel

   

Why is the user defined time’s location nil

1  Asked on December 23, 2021 by kelly-flet

 

Can i uncheck radio button?

3  Asked on December 23, 2021 by frankfurt

     

Call this.Hide() but the Form is still activated on Win10

0  Asked on December 23, 2021 by jonney

 

How do you remotely update Java applications?

9  Asked on December 23, 2021 by david-crow

   

how to embed plot in gtk and glade

1  Asked on December 23, 2021 by user169808

     

Multivariate normal density in Python?

10  Asked on December 23, 2021 by benno

       

onBlur for div element in React

1  Asked on December 23, 2021 by neel-dsouza

   

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP