kotlin

kotlin

Get the versions info in Kotlin runtime

Kotlin stdlib comes with one class called KotlinVersion, that provides different properties to check the current Kotlin version runtime.

Read
kotlin

Visibility modifiers: Private, protected, internal, and public

In Kotlin, we can define a class member as private, internal, public or protected. These are also called visibility modifiers. It defines the scope from where we can access a member.

Read
kotlin

Different ways to read the content of a file in Kotlin

We have a couple of different ways to read the file content in Kotlin. For these examples, we have created one readme.md file with the below content :.

Read
kotlin

Difference between double and triple equal in Kotlin

Double equal "==" and triple equal "===" are used for equality check in Kotlin. Both are different and not exactly same as like Java. In this post, we will see how these equal check works.

Read
kotlin

Different ways to convert a string to number in Kotlin

In this post, I will show you different ways to convert a string to number in Kotlin. This problem has a lot of use cases like your application is getting string values from the server and you want to convert it to number safely before processing. Or you want to convert the user input value to number before sending to the server. Let's check the programs :.

Read
kotlin

Finding out random numbers in Kotlin

We have a couple of different ways to generate random numbers in Java. Starting from Kotlin 1.3, one new package kotlin.random was introduced for a pseudo-random generation. So, if your project is using 1.3 or later Kotlin version, you can use this package.

Read
kotlin

Kotlin program to capitalize first letter/character of each words in a sentence

In this Kotlin programming tutorial, I will show you different ways to capitalize the first letter of each words in a string. We can't modify a string as it is immutable. We will create one new string from the original string. a sentence

Read
kotlin

Kotlin program to Capitalize the first character or letter of a string

In this post, I will show you two different ways to capitalize the first character of a string. If the input string is "hello", it should print "Hello".

Read
kotlin

Kotlin program to remove special characters from a string

In this tutorial, we will learn how to remove all special characters from a string in Kotlin. Our program will remove all non-alphanumeric characters excluding space. For example, if the string is abc 123 *&^, it will print abc 123.

Read
kotlin

Kotlin program to convert character array to string

Sometimes we need to convert one character array to a String. For example, if the array is ['a','b','c','d','e'], we may need to convert it to string abcde or a-b-c-d-e etc. It is pretty easy in kotlin to convert one character array to string. In this tutorial, I will show you two different ways to do that.

Read