Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# substring from end

// C# 8 introduced indices and ranges which allow you to write
str[^2..] = str.Substring(str.Length - 2, 2)
str[..^2] = str.Substring(2, str.Length - 2)

// In fact, this is almost exactly what the compiler will generate, 
//  so there's no overhead.
// Note that you will get an ArgumentOutOfRangeException if 
// the range isn't within the string.
Comment

PREVIOUS NEXT
Code Example
Csharp :: C# delete folder with all contents 
Csharp :: c# map 
Csharp :: unity assembly 
Csharp :: c# console foreground color 
Csharp :: unity topdown movement 
Csharp :: how to make a mouse down condition in unity 
Csharp :: remove comma from string c# 
Csharp :: c# append text to file 
Csharp :: cannot convert string to generic type c# 
Csharp :: how to get hours and minutes from second in c# 
Csharp :: instantiate list with values c# 
Csharp :: unity get child gameobject 
Csharp :: c# find element by condition 
Csharp :: c# unity get name of object 
Csharp :: how to write int array to console c# 
Csharp :: c# 2d list 
Csharp :: xamarin forms open new page on button click 
Csharp :: c# array to string 
Csharp :: c# cast to int 
Csharp :: c-sharp - get current page url/path/host 
Csharp :: how to look for substring in string in c# 
Csharp :: how to generate random number in unity 
Csharp :: unity c# random number 
Csharp :: linear search c# 
Csharp :: how to make text show a variable in unity 
Csharp :: project mongodb c# 
Csharp :: update multiple records with entity framework 
Csharp :: sequelize count all 
Csharp :: c# add object to array 
Csharp :: c# empty list 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =