Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity convert number to notation

public double number = 1000;
public string numberString = $"Number: {number}";

if (mumber >= 1000) {
  var exponent = (System.Math.Floor(System.Math.Log10(System.Math.Abs(number))));
  var mantissa = (number / System.Math.Pow(10, exponent));
  numberString = $"Number: {mantissa}e{exponent}";
}
else {
  numberString - $"Number: {number}"
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: deserialize json to dynamic object c# 
Csharp :: c# max two values 
Csharp :: parse strings into words C# 
Csharp :: wpf textblock line break code behind 
Csharp :: c# function 
Csharp :: c# online compiler 
Csharp :: yield c# 
Csharp :: vb.net read text file line by line 
Csharp :: c# replace multiple characters 
Csharp :: unity respawn c# 
Csharp :: print a file from C# 
Csharp :: unity switch to scene and transfer data 
Csharp :: c# parse number from string 
Csharp :: get domain name from email in asp.net c# 
Csharp :: rotate along normal unity 
Csharp :: c# remove everything after last slash 
Csharp :: how to keep rigidbody2D upright unity 
Csharp :: unity agent look at 
Csharp :: distance between two objects unity 2d 
Csharp :: two linked list intersection 
Csharp :: C# loop through the registry searching for keys containing 
Csharp :: player input manager join manually 
Csharp :: render section asp.net mvc layout 
Csharp :: C# 1 minute delay 
Csharp :: unity werfen mit höhe 
Csharp :: C# Blocks with statements 
Csharp :: how to query items with any id in a list of ids linq c# 
Csharp :: translate int to string with x 0 before c# 
Csharp :: c# program exit 
Csharp :: multi case in c# 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =