Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# remove everything after last slash

string input = "http://www.somesite.com/somepage.aspx?whatever";
int index = input.LastIndexOf("/");
if (index >= 0)
    input = input.Substring(0, index); // or index + 1 to keep slash
Comment

PREVIOUS NEXT
Code Example
Csharp :: return an interface or a class C# 
Csharp :: Oculus Unity button press 
Csharp :: Convert Json String to model Class or Object 
Csharp :: enable cors asp.net mvc 
Csharp :: migrationbuilder insert data example 
Csharp :: c# null conditional operator if statement 
Csharp :: c# return tuple 
Csharp :: c# inheritance 
Csharp :: singleton pattern c# 
Csharp :: List C# add from List 
Csharp :: c# structure 
Csharp :: dynamically add rows to datagridview c# 
Csharp :: c# creating an array 
Csharp :: timer unity 
Csharp :: remove duplicates in the list using linq 
Csharp :: c# write line 
Csharp :: .net on vs code 
Csharp :: check if two timespans intersect c# 
Csharp :: c# read excel file using epplus save to datatable 
Csharp :: asp.net get most recent file in directory 
Csharp :: superscript list 
Csharp :: how to make a block disappear in unity 
Csharp :: C# foreach loop async but wait at end 
Csharp :: change color unity over time 
Csharp :: C# check if object is default 
Csharp :: c# .net core entity framework one to many 
Csharp :: wpf keydown detect if control key is down 
Csharp :: c# get executing file name 
Csharp :: array in c# 
Csharp :: c# datagridview center cell text 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =