Problem Statement Write a function ‘fib(n)’ that takes in a number as an argument.The function should return the n-th number of the Fibonacci sequence. The 1st and 2nd number of the sequence is 1.To generate the next number of the sequence, we sum the previous two. Example:n : 1,2,3,4,5,6,7, 8, 9,…fib(n): 1,1,2,3,5,8,13,21,34,.. if n=7, the […]
Let’s say I want to prepare a Map from a List of Strings, I use below code to achieve, Expected result: Actual result: Solution To fix the problem, we need to pass merge function along with KeyMapper and ValueMapper, And here is the expected and actual result,
I encounter this error “flutter material icons-the getter ‘currency_rupee’ isn’t defined for the type ‘Icons‘” when I try to add ‘currency_rupee’ in one of my mobile development. This can be fixed using below solutions, 1. Make sure to use latest flutter version Download later version of flutter from https://docs.flutter.dev/get-started/install and verify of your Icons.dart file […]
1. How to display alert popups in pdf script ? . Include this statement either in document level or field level script. This will popup alert box when we open or action on the fields. 2. How to get numbers with leading with 0 in pdf script ? This will get the value of ‘field_name’ […]
Let’s take a use case, we need to fetch a company details by passing it’s company name in a GET Api url. We will get appropriate results as long as the company name doesn’t have any special characters, especially “;”, “/”, “?”, “:”, “@”, “=” and “&” Why it breaks when we use ‘&’ ? […]
Below code snippet shows the implementation of save method of JPARepository. So, when we hit the save method of JPARepository, it first checks if the given entity already exists or not by hitting select query and if not exists only then executes insert else it updates the existing record. How do I stop executing select […]
Predefined Character Classes This is shorthand of Character Classes. Instead of mentioning the character range, we will mention the predefined type of the character. Construct Description . Any character (may or may not match line terminators) \d A digit: [0-9] \D A non-digit: [^0-9] \s A whitespace character: [ \t\n\x0B\f\r] \S A non-whitespace character: [^\s] \w A word character: [a-zA-Z_0-9] […]
Character Classes If we browse through java regular expressions, we immediately find a table summarizing regular expression constructs. Yes, that’s what we are going to see here. In below table, the left-hand column specifies the regular expression constructs, while the right-hand column describes the conditions under which each construct will match. Construct Description [abc] a, […]
String Literals The most basic form of pattern matching is form of String matching. The pattern here is nothing but a simple string search we want to perform on the given input string. From here, let’s take String replace method which accepts a regularExpression and replacementString as arguments. Metacharacters These are the special characters that […]
What is Java Regular Expressions? From Oracle, it says “Regular expressions are a way to describe a set of strings based on common characteristics shared by each string in the set.” In order to define that common characteristics, we prepare a sequence of characters called ‘Pattern’. These patterns can be used to search, edit, or […]