JavaScript Remove whitespace of String | Beginning & End, Between

Use a replace() and trim() method to Remove whitespace of string in JavaScript(). The trim() method do not support in browsers, you can remove whitespaces from both sides of a string or between words using replace() method with a regular expression: Methods in JS to remove string whitespace replace() – Used with regular expression. trim() Read More…


Javascript line break in HTML | br Tag | Alert box “\n”

Break a line in JavaScript can do by using a “br” tag. If you have 2 or more a string then add br enclosed between 2 brackets < > enclosed in double quotation marks, and preceded and followed by the + sign: USE JS to insert a line break into HTML? The example of concatenated 2 Read More…


Check if a string contains a substring in Javascript

You can find a substring in a string using a classic indexOf() or the new ES6 includes() in Javascript. It’s very easy to do in Javascript programming. If you want a search particular word like a “Hello” then you have to use a regex (regular expression). Methods to Check if a string contains substring JavaScript indexOf()  includes() Read More…


How to check if JavaScript string contains a character

To find a character in a String has to use a includes() method in the JavaScript program. Another way to a string contains a certain character using a regular expression. They include() method finds the “contains” character in whole string, it will return a true. Example 1: Find a “t” character in the string. Output: Read More…


Python check if key exists in dictionary | key(), if & in, has_key()

To check the given value is given key already exists in a dictionary, you can use an Inbuilt method keys(), if and in operator or method has_key(). The in keyword is the best way to do it. Common Methods to Find given key already exists in a dictionary Inbuilt method keys() Using if and in Inbuilt method has_key() Examples check if key exists in the dictionary Read More…


Create Python global variables in a function & Use in Other Functions

A variable declared outside of the function or in the global scope (class level) is known as Global Variables in Python. These are defined and declared outside a function and we need to use them inside a function. Declare the Global variable when you want to use the same variable for the rest of the Read More…


WebViewClient onPageFinished() | listen for a WebView finishing loading a URL

To know about the URL loaded or not in WebView have to use the webViewClient onPageFinished() method. A WebView to have a WebViewClient to make use of the onPageFinished event callback. You should first know about the- What is WebView in Android? 2 main callback methods of WebView Client:- onPageStarted – Page loading started onPageFinished Read More…


Java convert Set to List | ArrayList to HashSet

Java converts Set to List by using many methods like- Loop traverse, ArrayList constructor, addAll method, Java 8 Stream, Guava Library List.newArrayList(set). There is one more easiest way to convert Set to List in Java. Both both Set and List are extended the Collection, so converting Set into the list is quite straightforward. It only Read More…


Android text underline XML layout | TextView Kotlin/Java

You can define the underlined text in an Android layout XML using a String Resouce XML file. In a string res file you have to use an HTML underline tag <u> </u>. Another way is to underline text in TextView android programmatically. String resource XML If you are using a string resource XML file (supports HTML tags), it can be Read More…


Difference between two lists elements | With & Without set() example

One of the best to find a Difference between two lists elements is the Python set() method. You will find many ways to do it, with and without the set() method. Ways To Find The Difference Between Two Lists Use Set() Using Nested Loops List Comprehension Let’s See one by one Example Use set() This Read More…