How to Create an Empty String in Kotlin? - Tutorial Kart
How to Create an Empty String in Kotlin?
Kotlin ? Create Empty String
To create an empty String in Kotlin, assign the variable with empty double quotes "" , or with String class constructor String() .
The syntax to create an empty String using double quotes is
myStr = ""
The syntax to create an empty String using String constructor is
myStr = String()
Examples
In the following program, we will create an empty String using double quotes. To check if the string is empty or not, we will print String.isEmpty().
Main.kt
fun main(args: Array) { var myStr = "" println("Is the String empty : ${myStr.isEmpty()}")
}
Output
Is the String empty : true
In the following program, we will create an empty String using String constructor.
Main.kt
fun main(args: Array) { var myStr = String() println("Is the String empty : ${myStr.isEmpty()}")
}
}
Output
Is the String empty : true
Conclusion
In this Kotlin Tutorial, we learned how to create an empty String using double quotes or String constructor, with the help of examples.
Kotlin Java Kotlin Tutorial Getting Started Setup Kotlin(Java) Project Kotlin Example Program Convert Java to Kotlin Kotlin Main Function Kotlin Loops Kotlin For Loop Kotlin While, Do While Loops Kotlin Repeat Kotlin Ranges Kotlin When
Object Oriented Concepts Classes Kotlin - Class, Primary and Secondary Constructors Kotlin Sealed Class Kotlin Data Class Kotlin Enum Kotlin - Extension Functions
Inheritance Kotlin Inheritance Kotlin Override Method of Super Class Abstraction Kotlin Abstraction Kotlin Abstract Class Kotlin - Interfaces Kotlin Null Safety
Exception Handling Kotlin Try Catch Kotlin Throw Exception Kotlin Custom Exception
Fix Compilation Errors Kotlin - Variable must be initialized Kotlin - Primary Constructor call expected Kotlin - Null can not be a value of a non-null type String Kotlin - Cannot create an instance of an abstract class
Kotlin - String Operations Kotlin - Compare Strings Kotlin - Replace String Kotlin - Split String Kotlin - Split String to Lines Kotlin - String Capitalize
Kotlin - Functions Kotlin Function - Default Arguments Kotlin - Use Function
Kotlin Collections Kotlin List
Kotlin List Kotlin List forEach
Kotlin File Operations Kotlin - Create File Kotlin - Read File Kotlin - Read File as List of Lines Kotlin - Write to File Kotlin - Append Text to File Kotlin - Check if File Exists Kotlin - Copy a File to Other Kotlin - Iterate through all files in a directory Kotlin - Delete Recursively Kotlin - Get File Extension
Kotlin Interview Q/A Kotlin Interview Questions
Kotlin Android Kotlin Android Tutorial
Useful Resources How to Learn Programming
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- declare null string java the gemini residences
- how to create an empty string in kotlin tutorial kart
- angular coding standards perfomatix
- string delimiter nullstr test expected nullstr arg is omitted all these
- javascript basics stanford university
- declare an empty string in python
- languages and regular expressions university of illinois urbana champaign
- declare null string java majestic temps
- typescript handbook
- typescript quick reference hooman b com
Related searches
- how to create an email account
- how to create an effective mission statem
- how to create an effective mission statement
- how to create an array in java
- how to create an amortization schedule excel
- how to create an email address
- create an empty array in python
- how to create an array in python
- how to create an array in powershell
- how to create an equation in excel
- how to create an empty array numpy
- how to create an object in javascript