Category Software Engineering

Reverse Letters in Kotlin

The problem# Given a string str, reverse it omitting all non-alphabetic characters. Examples: For str = “krishan”, the output needs to be “nahsirk”. For str = “ultr53o?n”, the output needs to be “nortlu”. Enter/Output: A string consists of lowercase Latin letters, digits, and symbols. The…

Base64 Encode a String in Java

Fast resolution# In brief, you possibly can simply do that: new String(Base64.getEncoder().encode(bytes)); Examples and a proof# In Java 8 and above, you simply have to import the Base64 class: import java.util.Base64; Then use the Base64 static strategies as follows: byte[]…

How you can Base64 Encode/Decode in Golang

Go ships with an encoding/base64 package deal that permits for encode and decoding of Base64 strings. Import the base64 package deal after which begin utilizing it! Base64 encode/decode a string# package deal major import ( b64 “encoding/base64” “fmt” ) func…