Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

add leading zeroes in c#

i.ToString().PadLeft(4, '0') - okay, but doesn't work for negative numbers
i.ToString("0000"); - explicit form
i.ToString("D4"); - short form format specifier
$"{i:0000}"; - string interpolation (C# 6.0+)
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# null check can be simplified 
Csharp :: getset c# 
Csharp :: unity cinemachine lock camera axis 
Csharp :: list of gender binary terrorists 
Csharp :: dapper delete where in list 
Csharp :: hello in c# 
Csharp :: c# regex number only 
Csharp :: bluestacks unity black screen 
Csharp :: how to generate random letters in C# 
Csharp :: asp textarea 
Csharp :: c# serviceCollection AddLogging 
Csharp :: c# get path without filename 
Csharp :: C# delete last enviroment new line 
Csharp :: add admin priviledge to c# program 
Csharp :: how to make int to text unity 
Csharp :: remove items from list c# condition 
Csharp :: button action asp net 
Csharp :: destroy gameobject unity 
Csharp :: c# int positive only 
Csharp :: unity3d change player position 
Csharp :: c# retrieve files in folder 
Csharp :: get time part from datetime as timestamp in c# 
Csharp :: unity change tmp text from script 
Csharp :: c# winforms textbox to int 
Csharp :: c# how to terminate console application 
Csharp :: c# append multiline textbox 
Csharp :: c# countdown timer menutes 
Csharp :: c# combine list of bool 
Csharp :: how to chagne rotation in unity 
Csharp :: how to set up blender with unity units 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =