What do you want to save?
Add Code snippet
New code examples
-
C# 2021-09-08 23:29:02
Type Conversion Methods
int myInt = 10; double myDouble = 5.25; bool myBool = true; Console.WriteLine(Convert.ToString(myInt)); // convert int to string Console.WriteLine(Convert.ToDouble(myInt)); // convert int to double Console.WriteLine(Convert.ToInt32(myDouble)); // ... Add solution -
Python 2021-09-08 16:56:02
python print bool as string
isFoo = True // our bool variable // now we use str() to cast bool to string print('Value of isFoo is: ' + str(isFoo)) // Value of isFoo is: True // common mistake just for example. Don't do that print('Value of Foo is: ' + isFoo) // TypeError: can only... Add solution -
Java 2021-09-06 04:36:02
Java program to sort names in an alphabetical order
// java sort string characters alphabetically import java.util.Arrays; public class CharactersAlphabetically { public static void main(String[] args) { String strInput = "flowerbrackets"; // converting string to char array ... Add solution -
C# 2021-09-06 01:52:02
c# sha1 password example
System.Security.Cryptography.SHA1 hasher = System.Security.Cryptography.SHA1.Create(); string Password = "1234"; // Convert to bytes Byte[] PasswordAsBytes = System.Text.Encoding.UTF8.GetBytes(Password); // Hash bytes Byte[] HashedPassword = has... Add solution -
Other 2021-09-03 20:49:01
Generate 10 verification codes of length 4 and print them, e.g.,
#random package to find random integer import random #This method returns a random value of given length #len - parameter determines the length of the random value def random_value(len): result = '' #len decrements with each iteration #Hence... Add solution -
Python 2021-09-03 18:20:02
Take n as input and check which ones are Armstrong number using a function in the range 1 to n in python
num = 370 # Changed num variable to string, # and calculated the length (number of digits) order = len(str(num)) # initialize sum sum = 0 # find the sum of the cube of each digit temp = num while temp > 0: digit = temp % 10 sum += digit ** order... Add solution -
TypeScript 2021-09-01 09:55:01
convert all size units to terabytes in python
def convertFloatToDecimal(f=0.0, precision=2): ''' Convert a float to string of decimal. precision: by default 2. If no arg provided, return "0.00". ''' return ("%." + str(precision) + "f") % f def fo... Add solution