Cum se creeaza un folder nou in linux din terminal
Creare folder din terminal in linux.
[mai mult...]Soluții pentru problemele tale IT
Creare folder din terminal in linux.
[mai mult...]Crearea unor fisiere din terminal in linux.
[mai mult...]If you’ve ever been curious about which apps you use most on your iPhone, there’s a way to keep track, but you have to turn on Apple’s Screen Time feature first.
[mai mult...]When you hit certain gaming milestones on the Xbox Series X|S, you’ll see achievement labels on the screen. If you find these notifications distracting, you can turn them off. By default, Xbox achievements appear in the center of the lower half of the screen, right on top of subtitles or the heads-up display in various games. There are two ways to solve this problem: Turn off notifications completely or change the position of game achievement alerts.
[mai mult...]int, boolean, etc..) as objects.| Primitive Data Type | Wrapper Class |
|---|---|
| byte | Byte |
| short | Short |
| int | Integer |
| long | Long |
| float | Float |
| double | Double |
| boolean | Boolean |
| char | Character |
Sometimes you must use wrapper classes, for example when working with Collection objects, such as ArrayList, where primitive types cannot be used (the list can only store objects):
ArrayList<int> myNumbers = new ArrayList<int>(); // Invalid
ArrayList<Integer> myNumbers = new ArrayList<Integer>(); // Valid
[mai mult...] java.util.regex package to work with regular expressions. The package includes the following classes:Pattern Class – Defines a pattern (to be used in a search)Matcher Class – Used to search for the patternPatternSyntaxException Class – Indicates syntax error in a regular expression patternFind out if there are any occurrences of the word “w3schools” in a sentence:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main {
public static void main(String[] args) {
Pattern pattern = Pattern.compile("w3schools", Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher("Visit W3Schools!");
boolean matchFound = matcher.find();
if(matchFound) {
System.out.println("Match found");
} else {
System.out.println("Match not found");
}
}
}
// Outputs Match found
In this example, The word “w3schools” is being searched for in a sentence.
First, the pattern is created using the Pattern.compile() method. The first parameter indicates which pattern is being searched for and the second parameter has a flag to indicates that the search should be case-insensitive. The second parameter is optional.
The matcher() method is used to search for the pattern in a string. It returns a Matcher object which contains information about the search that was performed.
The find() method returns true if the pattern was found in the string and false if it was not found.
Flags in the compile() method change how the search is performed. Here are a few of them:
Pattern.CASE_INSENSITIVE – The case of letters will be ignored when performing a search.Pattern.LITERAL – Special characters in the pattern will not have any special meaning and will be treated as ordinary characters when performing a search.Pattern.UNICODE_CASE – Use it together with the CASE_INSENSITIVE flag to also ignore the case of letters outside of the English alphabet