• 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

    1. Overview Retrieving a variable’s name as a string in JavaScript can be a handy technique in various programming scenarios, from debugging to dynamic property handling. We’ll explore several methods to convert variable names into strings, covering different use cases. Let’s consider a situation where we have a JavaScript variable, say myVar, and our objective […]

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

  • 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. [toc] 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. var str='1,424'; str=str.replace(/\,/g,''); console.log(str); […]

  • 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. var ampersand = encodeURIComponent('&'); console.log(ampersand); Output %26 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 […]

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

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.