Resources
Answers
Examples
Sign in
Get Started
What do you want to save?
Add Code snippet
New code examples
Kotlin
2021-10-19 12:39:04
kotlin date to string
//create an extension function on a date class which returns a string private fun Date.dateToString(format: String): String { //simple date formatter val dateFormatter = SimpleDateFormat(format, Locale.getDefault()) //retu...
Add solution
Kotlin
2021-10-17 11:03:07
date to string kotlin
//create an extension function on a date class which returns a string private fun Date.dateToString(format: String): String { //simple date formatter val dateFormatter = SimpleDateFormat(format, Locale.getDefault()) //retu...
Add solution
Swift
2021-10-06 02:02:02
swift sha256 encryption
extension String { func sha256() -> String{ if let stringData = self.data(using: String.Encoding.utf8) { return hexStringFromData(input: digest(input: stringData as NSData)) } return "" } priv...
Add solution
Swift
2021-09-26 13:12:05
string.format swift
let str = String(format:"%d, %f, %ld", INT_VALUE, FLOAT_VALUE, DOUBLE_VALUE) let str = "\(INT_VALUE), \(FLOAT_VALUE), \(DOUBLE_VALUE)"
Add solution
Swift
2021-09-07 02:19:02
swift truncate a float
let formatted = String(format: "Angle: %.2f", angle)
Add solution
Swift
2021-09-04 23:00:02
format decimal place swift
let tip: Double = 15.2847320 let tipText: String = String(format: "%.2f", tip) // %.2f for two decimal places
Add solution
Swift
2021-09-04 17:17:02
swift from 1 to 01
import Foundation for myInt in 1 ... 3 { print(String(format: "%02d", myInt)) }
Add solution
Swift
2021-09-03 06:16:02
double to string swift
let c: String = String(format: "%.1f", a) print("c: \(c)") // c: 1.5
Add solution
‹
1
2
›
Best helpers
daily
weekly
monthly
for 3 months
SC1
+5
Scott Cumming
+5
Peace LX
+5
Vaishal Patel
+5
Gat
+5
Peter N
+5
show more
This website uses cookies to make IQCode work for you. By using this site, you agree to our
cookie policy
Welcome Back!
Sign up to unlock all of IQCode features:
Test your skills and track progress
Engage in comprehensive interactive courses
Commit to daily skill-enhancing challenges
Solve practical, real-world issues
Share your insights and learnings
Sign in
E-mail
Password
Recover lost password
Log in
Or log in with
Not registered?
Sign up takes less than a minute
Create a Free Account
Sign up to unlock all of IQCode features:
Test your skills and track progress
Engage in comprehensive interactive courses
Commit to daily skill-enhancing challenges
Solve practical, real-world issues
Share your insights and learnings
Sign up
Email
Password
Sign up for free
Or sign up with
By signing up, you agree to the
Terms and Conditions
and
Privacy Policy
. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.