kotlin

kotlin

Kotlin program to remove first and last characters of a string

Kotlin provides different methods to manipulate a string. In this post, we will learn different Kotlin string methods to remove the first and last characters of a string.

Read
kotlin

zip and unzip methods in Kotlin array

zip function builds one new list of paired elements from two existing arrays. Zipping transformation is useful to combine two array values. The final result is equal to the length of the smaller array if both arrays have different size. The extra elements of the larger array are not included in the final list.

Read
kotlin

Kotlin program to find the sum of all numbers of an array

Kotlin program to find the sum of all numbers in an array. One number array is given and we need to find out the sum of its numbers.

Read
kotlin

Different ways to get substring in a string in Kotlin

Kotlin string comes with different utility methods to extract one substring. These utility methods or extensions functions are better than what Java provides and they can get you substrings based on different conditions. In this post, I will show you how to use these Kotlin substring extension functions with examples.

Read
kotlin

Different ways to find the length of a string in Kotlin

In this tutorial, we will learn different ways to find the length of a string. Actually you can use string property length that gives the length of a string in Kotlin. I am showing you three different ways. But I would recommend you to use length.

Read
kotlin

Kotlin program to convert one list to string

Converting one list to string in Kotlin is easy. Kotlin provides one method to do that easily. It is called joinToString. In this post, I will show you how we can convert one list to string in Kotlin using joinToString with examples.

Read
kotlin

Kotlin program to convert one comma separated string to list

This tutorial will show you how to convert one comma separated strings to a list in Kotlin. Each word in the list will be one item of the list. For example, if the string is Hello, World, it will put both words in a list like ["Hello", "World"].

Read
kotlin

Kotlin program to check if an array contains any one of multiple values

In this tutorial, we will learn how to check if an array contains any one or another value in Kotlin. For example, if the array is 1, 2, 3, 4, 6, 8, if we check if it contains 1 or 3, then it should return true. Again, for the same array, if we check if it contains 10 or 11, it should return false because neither of these numbers exists in the array.

Read
kotlin

Kotlin program to find one element in a list of objects

In this Kotlin programming tutorial, we will learn how to find one element in a list of objects. Kotlin provides different ways to find values in a list. We will explore these with examples.

Read
kotlin

Kotlin find index of first element in an iterable/list

Kotlin provides one method called indexOfFirst that returns the index of the first element of an iterable or list. In this tutorial, I will show you how to use this method with different examples.

Read