Move articles out of java-strings part2
This commit is contained in:
@@ -16,3 +16,4 @@ This module contains articles about sorting algorithms.
|
|||||||
- [Selection Sort in Java](https://www.baeldung.com/java-selection-sort)
|
- [Selection Sort in Java](https://www.baeldung.com/java-selection-sort)
|
||||||
- [Sorting Strings by Contained Numbers in Java](https://www.baeldung.com/java-sort-strings-contained-numbers)
|
- [Sorting Strings by Contained Numbers in Java](https://www.baeldung.com/java-sort-strings-contained-numbers)
|
||||||
- [Radix Sort in Java](https://www.baeldung.com/java-radix-sort)
|
- [Radix Sort in Java](https://www.baeldung.com/java-radix-sort)
|
||||||
|
- [Sorting a String Alphabetically in Java](https://www.baeldung.com/java-sort-string-alphabetically)
|
||||||
|
|||||||
@@ -28,6 +28,12 @@
|
|||||||
<version>${lombok.version}</version>
|
<version>${lombok.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<version>${junit-jupiter-api.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.assertj</groupId>
|
<groupId>org.assertj</groupId>
|
||||||
<artifactId>assertj-core</artifactId>
|
<artifactId>assertj-core</artifactId>
|
||||||
@@ -52,6 +58,7 @@
|
|||||||
<commons-math3.version>3.6.1</commons-math3.version>
|
<commons-math3.version>3.6.1</commons-math3.version>
|
||||||
<org.assertj.core.version>3.9.0</org.assertj.core.version>
|
<org.assertj.core.version>3.9.0</org.assertj.core.version>
|
||||||
<commons-codec.version>1.11</commons-codec.version>
|
<commons-codec.version>1.11</commons-codec.version>
|
||||||
|
<junit-jupiter-api.version>5.3.1</junit-jupiter-api.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.baeldung.string.sorting;
|
package com.baeldung.algorithms.stringsort;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
package com.baeldung.string.sorting;
|
package com.baeldung.algorithms.stringsort;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import com.baeldung.string.sorting.AnagramValidator;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
class AnagramValidatorUnitTest {
|
class AnagramValidatorUnitTest {
|
||||||
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.baeldung.string.sorting;
|
package com.baeldung.algorithms.stringsort;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
class SortStringUnitTest {
|
class SortStringUnitTest {
|
||||||
12
core-java-modules/core-java-string-apis/README.md
Normal file
12
core-java-modules/core-java-string-apis/README.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
## Java String APIs
|
||||||
|
|
||||||
|
This module contains articles about string APIs.
|
||||||
|
|
||||||
|
### Relevant Articles:
|
||||||
|
- [Java 8 StringJoiner](https://www.baeldung.com/java-string-joiner)
|
||||||
|
- [Quick Guide to the Java StringTokenizer](https://www.baeldung.com/java-stringtokenizer)
|
||||||
|
- [Guide to java.util.Formatter](https://www.baeldung.com/java-string-formatter)
|
||||||
|
- [Guide to StreamTokenizer](https://www.baeldung.com/java-streamtokenizer)
|
||||||
|
- [CharSequence vs. String in Java](https://www.baeldung.com/java-char-sequence-string)
|
||||||
|
- [StringBuilder and StringBuffer in Java](https://www.baeldung.com/java-string-builder-string-buffer)
|
||||||
|
- [Generate a Secure Random Password in Java](https://www.baeldung.com/java-generate-secure-password)
|
||||||
55
core-java-modules/core-java-string-apis/pom.xml
Normal file
55
core-java-modules/core-java-string-apis/pom.xml
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>core-java-string-apis</artifactId>
|
||||||
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<name>core-java-string-apis</name>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>parent-java</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<relativePath>../../parent-java</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjdk.jmh</groupId>
|
||||||
|
<artifactId>jmh-core</artifactId>
|
||||||
|
<version>${jmh-core.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjdk.jmh</groupId>
|
||||||
|
<artifactId>jmh-generator-annprocess</artifactId>
|
||||||
|
<version>${jmh-generator.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Added for password generation -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.passay</groupId>
|
||||||
|
<artifactId>passay</artifactId>
|
||||||
|
<version>${passay.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-text</artifactId>
|
||||||
|
<version>${commons-text.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>core-java-string-apis</finalName>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<passay.version>1.3.1</passay.version>
|
||||||
|
<commons-text.version>1.4</commons-text.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -1,4 +1,11 @@
|
|||||||
package com.baeldung.string.password;
|
package com.baeldung.password;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.RandomStringUtils;
|
||||||
|
import org.apache.commons.text.RandomStringGenerator;
|
||||||
|
import org.passay.CharacterRule;
|
||||||
|
import org.passay.EnglishCharacterData;
|
||||||
|
import org.passay.CharacterData;
|
||||||
|
import org.passay.PasswordGenerator;
|
||||||
|
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -8,13 +15,6 @@ import java.util.stream.Collectors;
|
|||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.apache.commons.lang3.RandomStringUtils;
|
|
||||||
import org.apache.commons.text.RandomStringGenerator;
|
|
||||||
import org.passay.CharacterData;
|
|
||||||
import org.passay.CharacterRule;
|
|
||||||
import org.passay.EnglishCharacterData;
|
|
||||||
import org.passay.PasswordGenerator;
|
|
||||||
|
|
||||||
public class RandomPasswordGenerator {
|
public class RandomPasswordGenerator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.baeldung.string.streamtokenizer;
|
package com.baeldung.streamtokenizer;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.baeldung.string;
|
package com.baeldung.stringbuilderstringbuffer;
|
||||||
|
|
||||||
import org.openjdk.jmh.annotations.Benchmark;
|
import org.openjdk.jmh.annotations.Benchmark;
|
||||||
import org.openjdk.jmh.annotations.Scope;
|
import org.openjdk.jmh.annotations.Scope;
|
||||||
@@ -8,12 +8,12 @@ import org.openjdk.jmh.runner.RunnerException;
|
|||||||
import org.openjdk.jmh.runner.options.Options;
|
import org.openjdk.jmh.runner.options.Options;
|
||||||
import org.openjdk.jmh.runner.options.OptionsBuilder;
|
import org.openjdk.jmh.runner.options.OptionsBuilder;
|
||||||
|
|
||||||
public class StringBufferStringBuilder {
|
public class StringBuilderStringBuffer {
|
||||||
|
|
||||||
public static void main(String[] args) throws RunnerException {
|
public static void main(String[] args) throws RunnerException {
|
||||||
|
|
||||||
Options opt = new OptionsBuilder()
|
Options opt = new OptionsBuilder()
|
||||||
.include(StringBufferStringBuilder.class.getSimpleName())
|
.include(StringBuilderStringBuffer.class.getSimpleName())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
new Runner(opt).run();
|
new Runner(opt).run();
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.baeldung.string;
|
package com.baeldung.charsequence;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.baeldung.string.formatter;
|
package com.baeldung.formatter;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Formatter;
|
import java.util.Formatter;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.*;
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class StringFormatterExampleUnitTest {
|
public class StringFormatterExampleUnitTest {
|
||||||
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.baeldung.string.password;
|
package com.baeldung.password;
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Examples of passwords conforming to various specifications, using different libraries.
|
* Examples of passwords conforming to various specifications, using different libraries.
|
||||||
*
|
*
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.baeldung.string.streamtokenizer;
|
package com.baeldung.streamtokenizer;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.baeldung.stringjoiner;
|
package com.baeldung.stringjoiner;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -8,7 +8,7 @@ import java.util.List;
|
|||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
public class StringJoinerUnitTest {
|
public class StringJoinerUnitTest {
|
||||||
private final String DELIMITER_COMMA = ",";
|
private final String DELIMITER_COMMA = ",";
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
1|IND|India
|
||||||
|
2|MY|Malaysia
|
||||||
|
3|AU|Australia
|
||||||
|
@@ -9,12 +9,10 @@ This module contains articles about strings in Java.
|
|||||||
- [Removing Stopwords from a String in Java](https://www.baeldung.com/java-string-remove-stopwords)
|
- [Removing Stopwords from a String in Java](https://www.baeldung.com/java-string-remove-stopwords)
|
||||||
- [Java – Generate Random String](https://www.baeldung.com/java-random-string)
|
- [Java – Generate Random String](https://www.baeldung.com/java-random-string)
|
||||||
- [Java Base64 Encoding and Decoding](https://www.baeldung.com/java-base64-encode-and-decode)
|
- [Java Base64 Encoding and Decoding](https://www.baeldung.com/java-base64-encode-and-decode)
|
||||||
- [Generate a Secure Random Password in Java](https://www.baeldung.com/java-generate-secure-password)
|
|
||||||
- [Removing Repeated Characters from a String](https://www.baeldung.com/java-remove-repeated-char)
|
- [Removing Repeated Characters from a String](https://www.baeldung.com/java-remove-repeated-char)
|
||||||
- [Join Array of Primitives with Separator in Java](https://www.baeldung.com/java-join-primitive-array)
|
- [Join Array of Primitives with Separator in Java](https://www.baeldung.com/java-join-primitive-array)
|
||||||
- [Pad a String with Zeros or Spaces in Java](https://www.baeldung.com/java-pad-string)
|
- [Pad a String with Zeros or Spaces in Java](https://www.baeldung.com/java-pad-string)
|
||||||
- [Remove Emojis from a Java String](https://www.baeldung.com/java-string-remove-emojis)
|
- [Remove Emojis from a Java String](https://www.baeldung.com/java-string-remove-emojis)
|
||||||
- [Guide to java.util.Formatter](https://www.baeldung.com/java-string-formatter)
|
|
||||||
- [Remove Leading and Trailing Characters from a String](https://www.baeldung.com/java-remove-trailing-characters)
|
- [Remove Leading and Trailing Characters from a String](https://www.baeldung.com/java-remove-trailing-characters)
|
||||||
- [Concatenating Strings In Java](https://www.baeldung.com/java-strings-concatenation)
|
- [Concatenating Strings In Java](https://www.baeldung.com/java-strings-concatenation)
|
||||||
- [Java String Interview Questions and Answers](https://www.baeldung.com/java-string-interview-questions)
|
- [Java String Interview Questions and Answers](https://www.baeldung.com/java-string-interview-questions)
|
||||||
@@ -26,5 +24,4 @@ This module contains articles about strings in Java.
|
|||||||
- [Checking If a String Is a Repeated Substring](https://www.baeldung.com/java-repeated-substring)
|
- [Checking If a String Is a Repeated Substring](https://www.baeldung.com/java-repeated-substring)
|
||||||
- [How to Reverse a String in Java](https://www.baeldung.com/java-reverse-string)
|
- [How to Reverse a String in Java](https://www.baeldung.com/java-reverse-string)
|
||||||
- [String toLowerCase and toUpperCase Methods in Java](https://www.baeldung.com/java-string-convert-case)
|
- [String toLowerCase and toUpperCase Methods in Java](https://www.baeldung.com/java-string-convert-case)
|
||||||
- [Guide to StreamTokenizer](https://www.baeldung.com/java-streamtokenizer)
|
|
||||||
- More articles: [[<-- prev>]](/java-strings) [[next -->]](/java-strings-3)
|
- More articles: [[<-- prev>]](/java-strings) [[next -->]](/java-strings-3)
|
||||||
|
|||||||
@@ -14,5 +14,3 @@ This module contains articles about operations on strings in Java.
|
|||||||
- [Split a String in Java](https://www.baeldung.com/java-split-string)
|
- [Split a String in Java](https://www.baeldung.com/java-split-string)
|
||||||
- [Common String Operations in Java](https://www.baeldung.com/java-string-operations)
|
- [Common String Operations in Java](https://www.baeldung.com/java-string-operations)
|
||||||
- [Java toString() Method](https://www.baeldung.com/java-tostring)
|
- [Java toString() Method](https://www.baeldung.com/java-tostring)
|
||||||
- [CharSequence vs. String in Java](https://www.baeldung.com/java-char-sequence-string)
|
|
||||||
- [StringBuilder and StringBuffer in Java](https://www.baeldung.com/java-string-builder-string-buffer)
|
|
||||||
|
|||||||
@@ -4,12 +4,9 @@ This module contains articles about strings in Java.
|
|||||||
|
|
||||||
### Relevant Articles:
|
### Relevant Articles:
|
||||||
- [String Operations with Java Streams](https://www.baeldung.com/java-stream-operations-on-strings)
|
- [String Operations with Java Streams](https://www.baeldung.com/java-stream-operations-on-strings)
|
||||||
- [Java 8 StringJoiner](https://www.baeldung.com/java-string-joiner)
|
|
||||||
- [Quick Guide to the Java StringTokenizer](https://www.baeldung.com/java-stringtokenizer)
|
|
||||||
- [Use char[] Array Over a String for Manipulating Passwords in Java?](https://www.baeldung.com/java-storing-passwords)
|
- [Use char[] Array Over a String for Manipulating Passwords in Java?](https://www.baeldung.com/java-storing-passwords)
|
||||||
- [Compact Strings in Java 9](https://www.baeldung.com/java-9-compact-string)
|
- [Compact Strings in Java 9](https://www.baeldung.com/java-9-compact-string)
|
||||||
- [Java Check a String for Lowercase/Uppercase Letter, Special Character and Digit](https://www.baeldung.com/java-lowercase-uppercase-special-character-digit-regex)
|
- [Java Check a String for Lowercase/Uppercase Letter, Special Character and Digit](https://www.baeldung.com/java-lowercase-uppercase-special-character-digit-regex)
|
||||||
- [Sorting a String Alphabetically in Java](https://www.baeldung.com/java-sort-string-alphabetically)
|
|
||||||
- [String Not Empty Test Assertions in Java](https://www.baeldung.com/java-assert-string-not-empty)
|
- [String Not Empty Test Assertions in Java](https://www.baeldung.com/java-assert-string-not-empty)
|
||||||
- [String Performance Hints](https://www.baeldung.com/java-string-performance)
|
- [String Performance Hints](https://www.baeldung.com/java-string-performance)
|
||||||
- [Using indexOf to Find All Occurrences of a Word in a String](https://www.baeldung.com/java-indexOf-find-string-occurrences)
|
- [Using indexOf to Find All Occurrences of a Word in a String](https://www.baeldung.com/java-indexOf-find-string-occurrences)
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -430,6 +430,7 @@
|
|||||||
<module>core-java-modules/core-java-sun</module>
|
<module>core-java-modules/core-java-sun</module>
|
||||||
<module>core-java-modules/core-java-string-conversions</module>
|
<module>core-java-modules/core-java-string-conversions</module>
|
||||||
<module>core-java-modules/core-java-string-conversions-2</module>
|
<module>core-java-modules/core-java-string-conversions-2</module>
|
||||||
|
<module>core-java-modules/core-java-string-apis</module>
|
||||||
<module>core-java-modules/core-java</module>
|
<module>core-java-modules/core-java</module>
|
||||||
<module>core-java-modules/core-java-jvm</module>
|
<module>core-java-modules/core-java-jvm</module>
|
||||||
<module>core-scala</module>
|
<module>core-scala</module>
|
||||||
@@ -1193,6 +1194,7 @@
|
|||||||
<module>core-java-modules/core-java-sun</module>
|
<module>core-java-modules/core-java-sun</module>
|
||||||
<module>core-java-modules/core-java-string-conversions</module>
|
<module>core-java-modules/core-java-string-conversions</module>
|
||||||
<module>core-java-modules/core-java-string-conversions-2</module>
|
<module>core-java-modules/core-java-string-conversions-2</module>
|
||||||
|
<module>core-java-modules/core-java-string-apis</module>
|
||||||
<module>core-scala</module>
|
<module>core-scala</module>
|
||||||
<module>couchbase</module>
|
<module>couchbase</module>
|
||||||
<module>custom-pmd</module>
|
<module>custom-pmd</module>
|
||||||
|
|||||||
Reference in New Issue
Block a user