Shubham Vora

Shubham Vora

793 Articles Published

Articles by Shubham Vora

Page 3 of 80

How to take HTML form data as text and send them to html2pdf?

Shubham Vora
Shubham Vora
Updated on 23-Nov-2023 2K+ Views

The html2pdf is a JavaScript package that allows developers to convert the html to canvas, pdf, image, etc. It takes html as a parameter and adds that to the pdf or required document. Furthermore, it also allows users to download the document after adding the html content to that. Here, we will access the form and add it to the pdf using the html2pdf npm package. We will see different examples of adding form data to pdf. Syntax Users can follow the syntax below to take html form data as text and send them to html2pdf. var element = document.getElementById('form'); ...

Read More

How to Convert Date to String in TypeScript?

Shubham Vora
Shubham Vora
Updated on 31-Oct-2023 74K+ Views

It is common to show the date and time on the web or mobile application. As a user, have you ever seen any application which shows the date object as it is? It will never happen because it makes UX worst. So, we need to convert the date object to a string. After converting the date object to a string, we can format it according to our needs. The date format means ‘yyyy-mm-dd’, ‘dd-mm-yyyy’, etc. Also, we can do the same with the time string. We can display the hours, minutes, seconds, and milliseconds according to the need. In this ...

Read More

How to Create and Save text file in JavaScript?

Shubham Vora
Shubham Vora
Updated on 31-Oct-2023 117K+ Views

In this tutorial, we will learn to create and save the text file in JavaScript. Sometimes, developers need to get texts or content from the user and allow users to store content in a text file and allow the file to download to the local computer. Many JavaScript libraries are available to achieve our goal, but we have used the best two libraries in this tutorial to create and save the text file. Create a text file using custom text and save it to a local computer We will use normal JavaScript operations to create and save the text file ...

Read More

How to count JavaScript array objects?

Shubham Vora
Shubham Vora
Updated on 31-Oct-2023 26K+ Views

In this tutorial, we will learn to count JavaScript array objects. The array is the data structure containing the strings, numbers, objects, etc., in JavaScript. The object is the one kind of entity that contains properties and methods related to it. We can access the object's properties and invoke the object method using the object's references. Generally, To find the array length, we can use the array.length() method and it returns the total number of elements that the array includes. But what if we need to count only object elements? Here, this tutorial has various approaches to counting the total ...

Read More

Validating Indian vehicle number plate using Regular Expression

Shubham Vora
Shubham Vora
Updated on 27-Oct-2023 3K+ Views

In this problem, we will validate the Indian vehicle number plate using the regular expression. The regular expression is the search pattern created using the different characters, which we can use to match a particular pattern in the given string. Problem statement - We have given a string representing the Indian vehicle number plate. We need to use the regular expression to validate the given string. Sample Example Input: num1 = "GJ 03 AY 1097" Output: Yes Explanation - The given vehicle number plate is valid. Input: num2 = "TN 1A3 PZ 1287" ...

Read More

Validating UPI IDs using Regular Expressions

Shubham Vora
Shubham Vora
Updated on 27-Oct-2023 2K+ Views

In this problem, we will validate the UPI id using the regular expression. The UPI is the unified payment interface that is given to each customer, and other people can use it to transfer money to you. The UPI id contains alphanumeric characters. The UPI id should always contain a ‘@’ character. The UPI id should not have white spaces. The UPI id may have a dot(.) or hyphen(-). Problem statement − We have given an upi id in the string format. We need to validate the UPI id using the regular expression. Sample Examples Input: upi ...

Read More

Split Parenthesis Sequence into maximum valid Substrings

Shubham Vora
Shubham Vora
Updated on 27-Oct-2023 219 Views

In this problem, we need to split the parenthesis string into valid groups. When all opening brackets have related closing brackets, we can say that the group of parenthesis is valid. Problem Statement We have given a string containing open and closed parentheses. We need to split the string to get the maximum valid parenthesis string. Sample Examples Input: par = "(())()(()())" Output: (()), (), (()()), Explanation Each substring contains the valid parentheses sequence. Input: par = "()()" Output: (), () Explanation We have splited the string into two groups. Input: ...

Read More

Print Words with Prime length from a Sentence

Shubham Vora
Shubham Vora
Updated on 27-Oct-2023 768 Views

In this problem, we need to show all words of the string having the prime length. The logical part of the problem is getting the words from the string and checking whether its length is prime. We can check whether the length of the number is divisible by any number to ensure whether it is a prime number. Also, we will use the sieve of Eratosthenes and the wheel factorization algorithm to check whether the word length is a prime number. Problem statement − We have given a string alpha, and we need to print all words of ...

Read More

Minimum deletion such that XOR of adjacent digits is atmost 1

Shubham Vora
Shubham Vora
Updated on 27-Oct-2023 183 Views

In this problem, we will learn to find the count of minimum deletion required so that when we take the XOR of any two adjacent elements, we should either get 0 or 1. We will use the properties of the XOR operations to solve the problem. For example, when we take XOR of the same numbers, we always get 0; when we take XOR of the consecutive even and odd number, we get 1. Problem Statement We have given a num_str string containing the numeric digits. We need to count the minimum deletions required so that the XOR ...

Read More

Minimize operations to make String palindrome by incrementing prefix by 1

Shubham Vora
Shubham Vora
Updated on 23-Oct-2023 314 Views

In this problem, we will count the number of operations required by increasing the prefix characters of the given string. We will use character difference to count the minimum number of operations required to make string palindromic. Problem Statement We have given a string nums containing the numeric digits. We need to count a minimum number of operations required to convert a string into the palindrome. In one operation, we can select any prefix of the string and increment all prefix characters by 1. Sample Example Input nums = "22434" Output 2 Explanation ...

Read More
Showing 21–30 of 793 articles
« Prev 1 2 3 4 5 80 Next »
Advertisements