• 25 May

    Format Date to yyyy-MM-dd in java

    In this post, we will see how to Format Date to yyyy-MM-dd in java. There are multiple ways to format Date to yyyy-MM-dd in java. Let’s go through them. Using DateTimeFormatter with LocalDate (Java 8) To Format Date to yyyy-MM-dd in java: Create a LocalDateTime object. Use DateTimeFormatter.ofPattern() to specify the pattern yyyy-MM-dd Call format() […]

  • 25 May

    [Solved] TypeError: toLowerCase is not a function in JavaScript

    TypeError: .toLowerCase is not a function occurs when we call toLowerCase() function on object which is not an string. toLowerCase() function can be only called on string. To resolve this issue, convert value to string using toString() ,method before calling toLowerCase() method. Let’s see with help of simple example [crayon-678cf057108ad096306153/] You will get following error […]

  • 25 May

    Remove Comma from String in JavaScript

    In this post, we will see how to remove comma from String in Javascript. There are multiple ways to do it. Let’s go through them. Using replace() To remove comma from String in Javascript: Use replace() method with regular expression /\,/g as first parameter and empty string as second parameter. [crayon-678cf057109f5535776933/] Output: [crayon-678cf057109f9649861018/] The replace() […]

  • 25 May

    Escape Json String Containing Newline Characters in JavaScript

    In this post, we will see how to escape JSON string containing newline characters using JavaScript. There is no well known JavaScript library which can escape all special characters in String. Escape JSON string in JavaScript There is no direct way to escape JSON String in JavaScript. You could however chain string's replace() method and […]

  • 25 May

    Escape new line in JavaScript

    In this post, we will see how to escape new line in JavaScript. There is no well known JavaScript library which can escape all special characters in String. Escape new line in JavaScript To escape new line in JavaScript: Use replace() method with regular expression /[\n]/g as first parameter and \\n string as second parameter. […]

  • 24 May

    Replace Comma with Space in List in Python

    In this post, we will see how to replace comma with space in the list. How to replace comma with space in list in Python A list is one of the fundamental collection objects in Python. It can store multiple elements and we can access these elements using their respective index. When we display a […]

  • 24 May

    Print Degree Symbol in Python

    How to print degree symbol in Python? In Python, we use the print() function to display some characters. We can not only print the characters visible on our keyboard but can also display the characters that belong to the Unicode character set. In this article, we will learn how to print degree symbol in Python. […]

  • 23 May

    Escape Apostrophe in JavaScript

    In this article, we will see how to escape Apostrophe in JavaScript. Let’s see what happens if we have singe quote in String and we also use single quotes to declare the string in JavaScript. [crayon-678cf05710e1b635869821/] Output: unknown: Unexpected token (1:26) Ways to escape Apostrophe in JavaScript There are multiple ways to escape quotes in […]

  • 23 May

    Escape Ampersand in URL in JavaScript

    In this post, we will see how to escape ampersand in JavaScript. To escape Ampersand in JavaScript, use encodeURIComponent() in JavaScript. [crayon-678cf05710ee7326601332/] Output [crayon-678cf05710eea882660137/] As you can see that when we called encodeURIComponent, it encoded & to %26. You can use % to escape characters that aren’t allowed in URLs. Here & is 26 in […]