• 11 June

    Remove Parentheses From String in Java

    Java uses the Strings data structure to store the text data. This article discusses methods to remove parentheses from a String in Java. Java Strings Java Strings is a class that stores the text data at contiguous memory locations. The String class implements the CharSequence interface along with other interfaces. Strings are a constant data […]

  • 25 May

    Get Variable Name as String in JavaScript

    In this post, we will see how to get variable name as String in JavaScript. There are multiple ways to get Get variable name as String in JavaScript. Let’s go through them. Using Object.keys() To get variable name as String in JavaScript, use Object.keys() to get the keys array and get the first element. [crayon-62dfdd2d1859e453842364/] […]

  • 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-62dfdd2d18ca7491118827/] Output: [crayon-62dfdd2d18cb1571563060/] The replace() […]

  • 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. […]

  • 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-62dfdd2d19bba919367055/] Output [crayon-62dfdd2d19bc3502806625/] 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 […]

  • 18 May

    Fill Array With Random Numbers in Java

    The arrays are a commonly used data structure that stores the data in contiguous memory. In this article, you will understand different methods to fill the array with random numbers in Java. We will generate the random numbers using different library methods such as the Java Utility library’s Random class, the Java’s Math class, and […]

  • 18 May

    How to Sum BigDecimal Using Stream in Java

    This article discusses how to sum BigDecimal using stream. One of the significant features in Java 8 is the introduction of stream functionality and a way of carrying out the sum operation on streams of numbers like BigDecimal. BigDecimal objects are immutable like String. Once immutable objects are created they can not be modified. So […]

  • 18 May

    SAX Error – Content Is Not Allowed in Prolog

    This article discusses the SAX Error – Content is not allowed in prolog. The SAX parser is the XML parsing API that you can use to process the XML files. However, while using the SAX parser, you may encounter SAX error – content is not allowed in prolog. Sax Error Due to Invalid Text Before […]

  • 18 May

    Return True in Java

    This article discusses the methods to return true in Java. The article discusses general approach to return a boolean variable from a function in Java. Boolean Values in Java The boolean values in Java represent a truth or fallacy. To denote the truth boolean true is used while boolean false denotes the fallacy. You should […]