Kotlin: First Element of an Array

Introduction

Kotlin is a modern programming language that has gained popularity for its concise syntax, interoperability with Java, and strong type system. In this tutorial, we’ll describe a common task in programming – retrieving the first element of an array in Kotlin. It will be great things need to understand. Whether you’re a beginner or an experienced developer, understanding how to work with arrays is fundamental to many programming tasks.

Arrays in Kotlin:

An array is a collection of elements of the same type, stored in contiguous memory locations. In Kotlin, you can create an array using the arrayOf() function. Arrays are zero-indexed, meaning the first element is at index 0, the second at index 1, and so on. So we need to get which data need to check.

Example Code:

fun main() {
    // Creating an array of integers
    val numbers = arrayOf(1, 2, 3, 4, 5)

    // Retrieving the first element
    val firstElement = numbers[0]

    // Displaying the result
    println("The first element of the array is: $firstElement")
}

Explanation

Creating an Array: In the example, we define an array named numbers using the arrayOf() function. The array contains the integers 1, 2, 3, 4, and 5.

Retrieving the First Element: To get the first element of the array, we use square brackets and specify the index 0. In Kotlin, array indices start at 0, so numbers[0] retrieves the first element of the array.

Displaying the Result: Finally, we print the result using println(). The output will be “The first element of the array is: 1” since 1 is the first element in our array.

Expanding Your Knowledge:

Arrays in Kotlin are versatile, allowing you to perform various operations. Once you’ve grasped the basics, consider exploring:

  • Array Iteration: Learn how to traverse through array elements efficiently.
  • Array Modification: Explore techniques to modify array elements dynamically.

Conclusion

Retrieving the first element of an array in Kotlin is a simple and common operation. Understanding array indexing is crucial for working with arrays effectively. Kotlin’s concise syntax and expressive features make it a great language for various programming tasks.

Related Posts

Array Elements of Specific Index

Creating Byte Arrays in Kotlin

Kotlin – Create String Array

Creating Integer Arrays in Kotlin

Create Empty Array in Kotlin

Creating Arrays in Kotlin

Array Elements at Specific Index

Programmers rely on Arrays as reliable data structures because they provide a flexible and effective way to organise and store data. Finding a certain element in an array requires accessing the value at a given index, which is a problem that developers often confront.

We’ll examine the foundations of retrieving elements from arrays at certain indices in this article, clarifying the guiding ideas and providing useful examples.

To get element of Array present at specified index in Kotlin language, use Array.get() method. Call get() method on this array and pass the index as argument. get() method returns the element.

Understanding Array Index

Before delving into the nitty-gritty of retrieving array elements, let’s grasp the concept of array indices. An array index is essentially a numerical identifier assigned to each element within an array. These indices start at zero and increment by one for each subsequent element. For instance, in an array [1, 2, 3], the index of 1 is 0, the index of 2 is 1, and the index of 3 is 2.

Syntax for Accessing Array Elements in Kotlin

Accessing an element at a specific index in a Kotlin array is straightforward. You use the array name followed by square brackets containing the desired index. Let’s illustrate this with a simple example:

// Define an array
val myArray = arrayOf(10, 20, 30, 40, 50)

// Access the element at index 2
val elementAtIndex2 = myArray[2]

// Print the result
println("Element at index 2: $elementAtIndex2")

In this example, myArray[2] retrieves the element at index 2 in the array.

Error Handling in Kotlin

As in any programming language, it’s crucial to handle scenarios where the specified index might be out of bounds. Kotlin provides concise ways to do this using getOrNull or the getOrElse functions:

val indexToRetrieve = 10

// Using getOrNull
val elementOrNull = myArray.getOrNull(indexToRetrieve)
if (elementOrNull != null) {
    println("Element at index $indexToRetrieve: $elementOrNull")
} else {
    println("Index $indexToRetrieve is out of bounds.")
}

// Using getOrElse
val elementOrElse = myArray.getOrElse(indexToRetrieve) { -1 }
println("Element at index $indexToRetrieve: $elementOrElse")

Practical Use Cases in Kotlin

Let’s explore some practical scenarios where retrieving elements from arrays is crucial in Kotlin:

User Input Handling:

When dealing with user input that represents an index, you can utilize the entered index to fetch the corresponding element from the array dynamically.

val userInputIndex = getUserInputIndex()
val userElement = myArray.getOrNull(userInputIndex)
if (userElement != null) {
    println("Element based on user input: $userElement")
} else {
    println("User input index $userInputIndex is out of bounds.")
}

Iterating Through Array Elements:

Looping through an array and accessing elements at specific indices is a common practice. This is often employed in algorithms and data manipulation tasks.

for (i in myArray.indices) {
    println("Element at index $i: ${myArray[i]}")
}

Conclusion

Mastering the art of accessing elements from arrays at specified indices is a fundamental skill for Kotlin developers. Whether you’re a beginner or an experienced coder, understanding array indices opens doors to efficient data manipulation and retrieval. Armed with this knowledge, you’ll be better equipped to harness the full potential of arrays in your Kotlin projects.

Related Posts

Creating Byte Arrays in Kotlin

Kotlin – Create String Array

Creating Integer Arrays in Kotlin

Create Empty Array in Kotlin

Creating Arrays in Kotlin

Size of an Array in Kotlin

This article will teach you how to use the size property or count() function of the Array class in Kotlin to determine the size of a given array. Examples will be provided.

Kotlin Array Size

To get size of Array in Kotlin, read the size property of this Array object. size property returns number of elements in this Array.

We can also use count() function of the Array class to get the size. We will go through an example to get the size of the Array using count() function.

Arrays are a fundamental part of many programming languages, and Kotlin is no exception. If you’re working with arrays in Kotlin and need to find out how many elements it contains, you can easily get the size of an array using a simple method. In this article, we’ll explore how to obtain the size of an array in Kotlin.

Using the size Property

In Kotlin, arrays come with a built-in property called size that returns the number of elements in the array. This property is accessible directly on the array instance. Let’s take a look at a simple example:

fun main() {
    // Creating an array of integers
    val numbers = intArrayOf(1, 2, 3, 4, 5)

    // Getting the size of the array
    val size = numbers.size

    // Printing the result
    println("The size of the array is: $size")
}

In this example, we first create an array called numbers containing five integers. Then, we use the size property to obtain the size of the array and store it in the variable size. Finally, we print the result.

Dynamically Sized Arrays

It’s important to note that the size property can be used not only with fixed-size arrays but also with dynamically sized arrays. For example:

fun main() {
    // Creating an array of strings
    val names = arrayOf("Alice", "Bob", "Charlie")

    // Getting the size of the array
    val size = names.size

    // Printing the result
    println("The size of the array is: $size")
}

In this case, the names array is dynamically sized, meaning that we don’t specify the size when creating the array. The size property still works seamlessly to retrieve the number of elements in the array.

Conclusion

Obtaining the size of an array in Kotlin is a straightforward process using the size property. Whether you’re working with fixed-size arrays or dynamically sized arrays, the size property provides a convenient way to get the number of elements in the array.

In your Kotlin projects, always remember to leverage the language features to write clean and concise code. The size property is just one example of how Kotlin simplifies common programming tasks.

Related Posts

Creating Byte Arrays in Kotlin

Kotlin – Create String Array

Creating Integer Arrays in Kotlin

Create Empty Array in Kotlin

Creating Arrays in Kotlin

Check Two Strings are Equal in Kotlin

Creating Byte Arrays in Kotlin

Kotlin, a modern and expressive programming language, provides developers with various tools for working with data. One essential data structure is the Byte Array, which is used to store sequences of bytes efficiently. In this article, we will explore how to create Byte Arrays in Kotlin with examples and discuss their relevance in programming.

Understanding Byte Arrays

A Byte Array is a fundamental data structure that stores a sequence of bytes. It is a versatile tool for handling binary data, image files, network communication, and much more. In Kotlin, creating and manipulating Byte Arrays is straightforward.

Creating a Byte Array in Kotlin

There are several ways to create a Byte Array in Kotlin. Here are a few commonly used methods:

Using byteArrayOf

The byteArrayOf function allows you to create a Byte Array with specific byte values. For example:

val byteArray = byteArrayOf(0x48, 0x65, 0x6C, 0x6C, 0x6F) // Creates a Byte Array "Hello"

In this example, we create a Byte Array with ASCII values that spell out “Hello.”

Using toByteArray

You can convert a string to a Byte Array using the toByteArray function:

val str = "Kotlin"
val byteArray = str.toByteArray()

This method is useful when you need to work with text-based data in Byte Arrays.

Creating an empty Byte Array:

To create an empty Byte Array with a specific size, you can use the ByteArray constructor:

val emptyArray = ByteArray(10) // Creates an empty Byte Array with a size of 10

This is useful when you need to allocate memory for binary data.

Accessing and Manipulating Byte Arrays

Once you have created a Byte Array, you can perform various operations on it, such as:

Accessing elements

You can access individual elements in a Byte Array using square brackets and the index. For example:

val element = byteArray[0] // Accesses the first element of the array

Modifying elements:

To modify an element in the Byte Array, you can simply assign a new value:

byteArray[1] = 0x79 // Changes the second element to the ASCII value of 'y'

Iterating through the array:

You can use loops, such as for or forEach, to iterate through the elements of the Byte Array:

for (element in byteArray) {
    println(element)
}

Conclusion

Byte Arrays are essential for handling binary data in Kotlin. In this article, we have covered various methods for creating Byte Arrays and performing common operations on them. As you become more proficient in Kotlin, you’ll find these skills invaluable for working with network protocols, file I/O, and other binary data-related tasks.

Kotlin’s flexibility and ease of use make it a great choice for both beginners and experienced developers. We hope this article has provided you with a clear understanding of creating and manipulating Byte Arrays in Kotlin.

Related Posts

Kotlin – Create String Array

Creating Integer Arrays in Kotlin

Create Empty Array in Kotlin

Creating Arrays in Kotlin

Check Two Strings are Equal in Kotlin

Multiline Strings in Kotlin

Create Empty Array in Kotlin

In this article, we will explore various ways to declare and initialize empty Arrays in Kotlin. Whether you’re a beginner or an experienced Kotlin developer, you’ll find these methods useful.

Method 1: Using arrayOf()

The simplest way to create an empty array in Kotlin is by using the arrayOf() function. This function is provided by the Kotlin standard library and allows you to create an array with zero elements. Here’s an example:

val emptyArray = arrayOf<String>()

In this example, we’ve created an empty array of type String. You can replace String with any other data type as needed.

Method 2: Using emptyArray()

Another convenient way to create an empty array is by using the emptyArray() function. This function is part of the Kotlin standard library and returns an empty array of the specified type:

val emptyIntArray = IntArray(0)
val emptyStringArray = emptyArray<String>()

In the first line, we’ve created an empty array of integers, and in the second line, we’ve created an empty array of strings.

Method 3: Using the Array Constructor

You can also use the Array constructor to create an empty array. Here’s an example:

val emptyBooleanArray = Array(0) { false }

In this example, we’ve created an empty array of booleans. The Array(0) { false } part specifies the size of the array (0 in this case) and initializes its elements with false. You can replace false with the default value of the desired type.

Method 4: Declaring an Empty Array with Explicit Type

If you want to declare an empty array without initializing it, you can specify the type explicitly:

val emptyDoubleArray: Array<Double> = arrayOf()

In this example, we’ve declared an empty array of type Double by specifying the type explicitly.

Method 5: Using the emptyList() Function

If you’re working with lists but need an empty array, you can convert an empty list to an array using the toTypedArray() function:

val emptyArrayFromList = emptyList<String>().toTypedArray()

In this example, we’ve created an empty array of strings by first creating an empty list and then converting it to an array.

Now that you know several ways to create an empty array in Kotlin, you can choose the one that best suits your needs. Whether you prefer the simplicity of arrayOf(), the clarity of specifying the type, or any other method, you have the flexibility to work with empty arrays efficiently.

In conclusion, creating empty arrays in Kotlin is a breeze, and you can choose the method that best fits your coding style and requirements. Happy coding!

Related Posts

Creating Arrays in Kotlin

Check Two Strings are Equal in Kotlin

Multiline Strings in Kotlin

Comparing Strings in Kotlin

Mastering Kotlin String Concatenation

Print a String in Kotlin

Check Two Strings are Equal in Kotlin

String comparison is a common operation in programming, and it’s no different in Kotlin. Whether you need to validate user input, compare database values, or make decisions in your application, you’ll frequently encounter the need to check if two strings are equal. In this article, we will explore how to perform string equality checks in Kotlin.

Using the == Operator

In Kotlin, you can use the == operator to check if two strings are equal. This operator is overloaded for String objects, allowing you to compare their contents easily. Here’s a simple example:

fun main() {
    val string1 = "Hello, World"
    val string2 = "Hello, World"

    if (string1 == string2) {
        println("Strings are equal")
    } else {
        println("Strings are not equal")
    }
}

In this example, we declare two String variables, string1 and string2, and then use the == operator to compare their contents. If the contents of both strings are the same, it will print “Strings are equal” to the console.

Using the equals Function

While the == operator is the preferred way to check for string equality in Kotlin, you can also use the .equals() function for string comparison. This function allows you to specify additional options, such as ignoring character case.

Here’s how you can use .equals() for string comparison:

fun main() {
    val string1 = "Hello, World"
    val string2 = "hello, world"

    if (string1.equals(string2, ignoreCase = true)) {
        println("Strings are equal (case-insensitive)")
    } else {
        println("Strings are not equal")
    }
}

In this example, we use the .equals() function with the ignoreCase parameter set to true, which means it performs a case-insensitive comparison. As a result, it will print “Strings are equal (case-insensitive)” to the console, even though the letter casing is different.

Conclusion

Checking if two strings are equal is a common task in programming, and in Kotlin, you can accomplish this using the == operator or the .equals() function. The == operator is the recommended way for simple string equality checks, while the .equals() function provides additional options, such as case-insensitive comparison. Depending on your specific use case, you can choose the method that best suits your needs.

String comparison is a fundamental concept in many programming languages, and understanding how to perform it in Kotlin will be valuable for your software development projects.

Related Posts

Multiline Strings in Kotlin

Comparing Strings in Kotlin

Mastering Kotlin String Concatenation

Print a String in Kotlin

How to Find Kotlin String Length

Define String Constants in Kotlin

Multiline Strings in Kotlin

In Kotlin, you can write the multiple line String literal and enclose it in triple quotes to define a multiline string.

Use String to trim the indentation if you would like to.In addition to triple quotes, there is a trimIndent() function. The leading whitespace from each line is eliminated using the trimIndent() function.

Creating Multiline Strings

To create a multiline string in Kotlin, you simply enclose your text within triple quotes. For example:

val myMultilineString = """
    This is a multiline string.
    It can span multiple lines without escape characters.
"""

You can use triple double-quotes (""") to include line breaks without any escape sequences. This makes it easy to represent formatted text, code samples, or any content with natural line breaks.

Formatting and Indentation

Kotlin multiline strings are also useful for preserving the formatting of your text. You can add indentation to the string, and it will be included in the final output:

val indentedString = """
    This text is indented.
        This line is further indented.
    Back to the main level.
"""

The indentation is flexible, allowing you to format the content as you see fit. This is particularly useful when writing code snippets or structuring your blog articles.

Escaping Special Characters

While you don’t need to escape most special characters within multiline strings, there are cases where you might want to include a literal triple-quoted string inside your content. In such cases, you can escape the triple quotes:

val escapedString = """
    This is a multiline string with escaped triple quotes: \"""
"""

Use Cases

Multiline strings in Kotlin have various use cases. They’re perfect for:

  • Writing Blog Articles: As demonstrated in this very article, multiline strings are an excellent choice for composing lengthy blog posts with proper formatting.
  • Defining HTML Templates for Web Development: Multiline strings make it easy to define HTML templates within your Kotlin code. This can be especially useful for web development projects.
  • Including Code Samples: If you need to include code samples within your text, multiline strings preserve the formatting, making your code snippets more readable.
  • Creating Email Templates: When working on email templates, you can use multiline strings to maintain the structure and readability of your content.
  • Storing Large Text Content Within Your Code: Whether it’s legal documents, user agreements, or any other substantial text content, multiline strings allow you to keep it within your code while preserving the formatting.

Conclusion

Multiline strings in Kotlin are a versatile tool for working with large blocks of text. They help maintain the formatting of your content and make it easy to include code snippets and other text-rich data in your code. So the next time you need to write a blog post for your website, consider using Kotlin’s multiline strings for a cleaner and more concise approach.

Happy coding!

Related Posts

Comparing Strings in Kotlin

Mastering Kotlin String Concatenation

Print a String in Kotlin

How to Find Kotlin String Length

Define String Constants in Kotlin

Creating an Empty String in Kotlin

Comparing Strings in Kotlin

Programming’s most basic operation, String comparison, lets us determine whether two strings are equal or whether one is larger or shorter than the other.

There are various methods for comparing strings in Kotlin, a cutting-edge and expressive programming language. The many approaches and recommended techniques for comparing strings in Kotlin will be covered in this article.

Using == Operator

The simplest way to compare two strings for equality in Kotlin is by using the == operator. This operator checks whether the content of two strings is the same.

val str1 = "Hello"
val str2 = "World"

if (str1 == str2) {
    println("Strings are equal")
} else {
    println("Strings are not equal")
}

In this example, “Strings are not equal” will be printed since str1 and str2 contain different content.

Using compareTo() Function

To compare strings lexicographically (based on their Unicode values), you can use the compareTo() function. This function returns an integer that indicates the relative order of the two strings.

val str1 = "apple"
val str2 = "banana"

val result = str1.compareTo(str2)

if (result < 0) {
    println("$str1 comes before $str2")
} else if (result > 0) {
    println("$str1 comes after $str2")
} else {
    println("$str1 and $str2 are equal")
}

In this case, “apple comes before banana” will be printed because the compareTo() function returns a negative value.

Ignoring Case

If you want to perform a case-insensitive comparison, you can use the equals() function with the ignoreCase parameter.

val str1 = "Kotlin"
val str2 = "kotlin"

if (str1.equals(str2, ignoreCase = true)) {
    println("Strings are equal (case-insensitive)")
} else {
    println("Strings are not equal (case-insensitive)")
}

Here, “Strings are equal (case-insensitive)” will be printed because we’ve specified ignoreCase = true.

Check Prefix and Suffix

You can also check if a string starts with or ends with a specific substring using the startsWith() and endsWith() functions.

val text = "Hello, World!"

if (text.startsWith("Hello")) {
    println("Text starts with 'Hello'")
}

if (text.endsWith("World!")) {
    println("Text ends with 'World!'")
}

Both conditions in this example will evaluate to true.

Using Regular Expressions

Kotlin provides powerful support for regular expressions, which can be used to perform advanced string comparisons and manipulations.

val text = "The quick brown fox jumps over the lazy dog"

val pattern = Regex("brown")

if (pattern.containsMatchIn(text)) {
    println("Text contains the word 'brown'")
}

In this case, “Text contains the word ‘brown’” will be printed because the regular expression pattern matches the word “brown” in the text.

Conclusion

In this post, we’ve looked at a variety of Kotlin comparison methods, from straightforward equality tests to more intricate ones like regular expressions. The best way to utilise will rely on your unique use case and requirements. You’ll be better able to handle text processing and manipulation in your Kotlin projects if you have a firm grasp of string comparison in the language.

Keep in mind that string comparisons might affect speed, particularly when working with lengthy strings or in code that depends on it. Always take the effectiveness of your comparison method into account and select it based on how well it meets your needs.

You may utilise these methods with confidence in your Kotlin apps now that you have a firm understanding of string comparison in the language.

Related Posts

Mastering Kotlin String Concatenation

Print a String in Kotlin

How to Find Kotlin String Length

Define String Constants in Kotlin

Creating an Empty String in Kotlin

Kotlin – Initialize String

Mastering Kotlin String Concatenation

In Kotlin, you can combine Strings by using the concatenation operator +. Concatenation operators are frequently used as addition operators.

In business logic, strings are a highly common datatype, therefore you might occasionally need to concatenate two or more strings.

We will learn how to concatenate strings in the Kotlin programming language in this lesson.

The task of manipulating strings is a common and important one in the realm of programming. Kotlin, a flexible and succinct programming language, offers a number of effective methods for concatenating strings. We’ll look at many approaches and recommended techniques for string concatenation in Kotlin in this article.

Using the + Operator

The simplest way to concatenate strings in Kotlin is by using the + operator. You can use it to join two or more strings together:

val firstName = "John"
val lastName = "Doe"
val fullName = firstName + " " + lastName

This method is easy to understand and works well for small-scale concatenations. However, it can become inefficient when dealing with large numbers of strings, as it creates intermediate objects for each concatenation, leading to increased memory usage.

Using the StringBuilder Class

For more efficient string concatenation, Kotlin provides the StringBuilder class. This class allows you to build strings dynamically without creating unnecessary intermediate objects:

val stringBuilder = StringBuilder()
stringBuilder.append("Hello,")
stringBuilder.append(" Kotlin!")
val result = stringBuilder.toString()

StringBuilder is especially useful when you need to concatenate a large number of strings in a loop, as it minimizes memory overhead.

Using String Templates

Kotlin also supports string templates, which provide a concise and readable way to interpolate variables into strings:

val name = "Alice"
val greeting = "Hello, $name!"

String templates are a powerful tool for creating dynamic strings, and they make your code more readable.

Using joinToString Function

If you have a collection of strings and want to concatenate them with a separator, you can use the joinToString function:

val fruits = listOf("apple", "banana", "cherry")
val concatenated = fruits.joinToString(separator = ", ")

This function allows you to specify a separator and other formatting options.

Concatenating Strings in a Loop

When you need to concatenate strings within a loop, it’s essential to choose an efficient approach. Using StringBuilder is often the best choice:

val names = listOf("Alice", "Bob", "Charlie")
val stringBuilder = StringBuilder()
for (name in names) {
    stringBuilder.append(name).append(", ")
}
val result = stringBuilder.toString().removeSuffix(", ")

This code efficiently concatenates a list of names with a comma and space separator.

String concatenation is a fundamental operation in programming, and Kotlin provides several methods to perform it efficiently. Depending on your specific use case, you can choose between the + operator, StringBuilder, string templates, or the joinToString function. Remember to consider performance and readability when selecting the most suitable method for your code.

In summary, mastering string concatenation in Kotlin is essential for writing clean and efficient code. Choose the right technique for the job, and you’ll be well on your way to becoming a Kotlin string manipulation expert.

Related Posts

Print a String in Kotlin

How to Find Kotlin String Length

Define String Constants in Kotlin

Creating an Empty String in Kotlin

Kotlin – Initialize String

Kotlin String Operations with Example

How to Find Kotlin String Length

Programmers use strings as a fundamental building block to alter and display text. Knowing how to work with strings is essential in Kotlin, a popular programming language for Android app development and beyond.

The measurement of a string’s length is a crucial component of String manipulation. To help you learn this crucial ability, we’ll go over how to get the length of a string in Kotlin and offer real-world examples.

The length Property

In Kotlin, obtaining the length of a string is straightforward. The String class has a built-in property called length that returns the number of characters in the string. Let’s take a look at how you can use it:

fun main() {
    val myString = "Hello, Kotlin!"
    val length = myString.length

    println("The length of the string is $length")
}

In this example, we define a string myString containing the text “Hello, Kotlin!” and use the length property to determine its length. The result will be The length of the string is 13.

Handling Multilingual Text

Kotlin is a flexible language that is not just used for writing in English. It can handle strings that contain non-Latin characters and those that are in many different languages.

Regardless of the language or script used, the length attribute determines the length based on the amount of characters. For Example:

fun main() {
    val russianString = "Привет, мир!" // Hello, world! in Russian
    val length = russianString.length

    println("The length of the string is $length")
}

In this case, the length will be “The length of the string is 12”, as there are 12 characters in the Russian string.

Handling Unicode Characters

Kotlin also handles Unicode characters seamlessly. Each Unicode character, including emojis and special symbols, is counted as a single character by the length property:

fun main() {
    val emojiString = "😀🚀🌟"
    val length = emojiString.length

    println("The length of the string is $length")
}

The length of the emojiString in this example is "The length of the string is 3", even though it contains three emoji characters.

Handling Empty Strings

When dealing with empty strings, the length property returns 0:

fun main() {
    val emptyString = ""
    val length = emptyString.length

    println("The length of the string is $length")
}

In this case, the length will be “The length of the string is 0”.

Conclusion

Understanding how to determine the length of a string is a fundamental skill in Kotlin programming. The length property of the String class provides a simple and reliable way to achieve this. Whether you’re working with text in different languages, containing Unicode characters, or handling empty strings, Kotlin’s length property makes it easy to count characters accurately.

Mastering this skill will help you manipulate and format text effectively in your Kotlin applications, whether you’re developing Android apps, web applications, or any other software that involves text processing.

So, go ahead and use the length property to conquer string length challenges in your Kotlin projects!

Related Posts

Define String Constants in Kotlin

Creating an Empty String in Kotlin

Kotlin – Initialize String

Kotlin String Operations with Example

Kotlin – Create Custom Exception

Kotlin Throw Exceptions Handling