Skip to content

Commit

Permalink
Move articles out of java-strings part4
Browse files Browse the repository at this point in the history
  • Loading branch information
catalin-burcea committed Oct 30, 2019
1 parent 994651a commit ba50a42
Show file tree
Hide file tree
Showing 55 changed files with 299 additions and 340 deletions.
11 changes: 11 additions & 0 deletions core-java-modules/core-java-string-operations-2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Java String Operations

This module contains articles about string operations.

### Relevant Articles:
- [Concatenating Strings In Java](https://www.baeldung.com/java-strings-concatenation)
- [Checking for Empty or Blank Strings in Java](https://www.baeldung.com/java-blank-empty-strings)
- [String Initialization in Java](https://www.baeldung.com/java-string-initialization)
- [String toLowerCase and toUpperCase Methods in Java](https://www.baeldung.com/java-string-convert-case)
- [Java String equalsIgnoreCase()](https://www.baeldung.com/java-string-equalsignorecase)
- More articles: [[<-- prev]](../core-java-string-operations)
81 changes: 81 additions & 0 deletions core-java-modules/core-java-string-operations-2/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<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-operations-2</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>core-java-string-operations-2</name>

<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-java</relativePath>
</parent>

<dependencies>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${validation-api.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate-validator.version}</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>${javax.el-api.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.el</artifactId>
<version>${javax.el.version}</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>${org.hamcrest.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<finalName>core-java-string-operations-2</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>

<properties>
<assertj.version>3.6.1</assertj.version>
<validation-api.version>2.0.0.Final</validation-api.version>
<commons-lang3.version>3.8.1</commons-lang3.version>
<guava.version>27.0.1-jre</guava.version>
<hibernate-validator.version>6.0.2.Final</hibernate-validator.version>
<javax.el-api.version>3.0.0</javax.el-api.version>
<javax.el.version>2.2.6</javax.el.version>
</properties>

</project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.string.emptystrings;
package com.baeldung.emptystrings;

class EmptyStringCheck {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.string.emptystrings;
package com.baeldung.emptystrings;

class Java5EmptyStringCheck {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.string.emptystrings;
package com.baeldung.emptystrings;

class PlainJavaBlankStringCheck {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.string.emptystrings;
package com.baeldung.emptystrings;

import javax.validation.constraints.Pattern;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
package com.baeldung.string.changecase;

import static org.junit.Assert.assertEquals;

import java.util.Locale;

import org.junit.Test;

public class ToLowerCaseUnitTest {

private static final Locale TURKISH = new Locale("tr");
private String name = "John Doe";
private String foreignUppercase = "\u0049";

@Test
public void givenMixedCaseString_WhenToLowerCase_ThenResultIsLowerCase() {
assertEquals("john doe", name.toLowerCase());
}

@Test
public void givenForeignString_WhenToLowerCaseWithoutLocale_ThenResultIsLowerCase() {
assertEquals("\u0069", foreignUppercase.toLowerCase());
}

@Test
public void givenForeignString_WhenToLowerCaseWithLocale_ThenResultIsLowerCase() {
assertEquals("\u0131", foreignUppercase.toLowerCase(TURKISH));
}
}
package com.baeldung.changecase;

import org.junit.Test;

import java.util.Locale;

import static org.junit.Assert.assertEquals;

public class ToLowerCaseUnitTest {

private static final Locale TURKISH = new Locale("tr");
private String name = "John Doe";
private String foreignUppercase = "\u0049";

@Test
public void givenMixedCaseString_WhenToLowerCase_ThenResultIsLowerCase() {
assertEquals("john doe", name.toLowerCase());
}

@Test
public void givenForeignString_WhenToLowerCaseWithoutLocale_ThenResultIsLowerCase() {
assertEquals("\u0069", foreignUppercase.toLowerCase());
}

@Test
public void givenForeignString_WhenToLowerCaseWithLocale_ThenResultIsLowerCase() {
assertEquals("\u0131", foreignUppercase.toLowerCase(TURKISH));
}
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
package com.baeldung.string.changecase;

import static org.junit.Assert.assertEquals;

import java.util.Locale;

import org.junit.Test;

public class ToUpperCaseUnitTest {

private static final Locale TURKISH = new Locale("tr");
private String name = "John Doe";
private String foreignLowercase = "\u0069";

@Test
public void givenMixedCaseString_WhenToUpperCase_ThenResultIsUpperCase() {
assertEquals("JOHN DOE", name.toUpperCase());
}

@Test
public void givenForeignString_WhenToUpperCaseWithoutLocale_ThenResultIsUpperCase() {
assertEquals("\u0049", foreignLowercase.toUpperCase());
}

@Test
public void givenForeignString_WhenToUpperCaseWithLocale_ThenResultIsUpperCase() {
assertEquals("\u0130", foreignLowercase.toUpperCase(TURKISH));
}
}
package com.baeldung.changecase;

import org.junit.Test;

import java.util.Locale;

import static org.junit.Assert.assertEquals;

public class ToUpperCaseUnitTest {

private static final Locale TURKISH = new Locale("tr");
private String name = "John Doe";
private String foreignLowercase = "\u0069";

@Test
public void givenMixedCaseString_WhenToUpperCase_ThenResultIsUpperCase() {
assertEquals("JOHN DOE", name.toUpperCase());
}

@Test
public void givenForeignString_WhenToUpperCaseWithoutLocale_ThenResultIsUpperCase() {
assertEquals("\u0049", foreignLowercase.toUpperCase());
}

@Test
public void givenForeignString_WhenToUpperCaseWithLocale_ThenResultIsUpperCase() {
assertEquals("\u0130", foreignLowercase.toUpperCase(TURKISH));
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
package com.baeldung.string.emptystrings;
package com.baeldung.emptystrings;

import static org.hamcrest.Matchers.iterableWithSize;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

import java.util.Set;
import com.google.common.base.Strings;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;

import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import java.util.Set;

import org.apache.commons.lang3.StringUtils;
import org.junit.Test;

import com.google.common.base.Strings;
import static org.hamcrest.Matchers.iterableWithSize;
import static org.junit.Assert.*;

public class EmptyStringsUnitTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.string.equalsIgnoreCase;
package com.baeldung.equalsIgnoreCase;

import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.baeldung.initialization;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;

import org.junit.Test;

import static org.junit.Assert.*;

public class StringInitializationUnitTest {

private String fieldString;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung;
package com.baeldung.stringconcatenation;

import org.junit.Test;

Expand Down
16 changes: 16 additions & 0 deletions core-java-modules/core-java-string-operations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Java String Operations

This module contains articles about string operations.

### Relevant Articles:
- [Comparing Strings in Java](https://www.baeldung.com/java-compare-strings)
- [Check If a String Is Numeric in Java](https://www.baeldung.com/java-check-string-number)
- [Get Substring from String in Java](https://www.baeldung.com/java-substring)
- [Split a String in Java](https://www.baeldung.com/java-split-string)
- [Common String Operations in Java](https://www.baeldung.com/java-string-operations)
- [Java toString() Method](https://www.baeldung.com/java-tostring)
- [String Operations with Java Streams](https://www.baeldung.com/java-stream-operations-on-strings)
- [Adding a Newline Character to a String in Java](https://www.baeldung.com/java-string-newline)
- [Check If a String Contains a Substring](https://www.baeldung.com/java-string-contains-substring)
- [Java Base64 Encoding and Decoding](https://www.baeldung.com/java-base64-encode-and-decode)
- More articles: [[next -->]](../core-java-string-operations-2)
66 changes: 66 additions & 0 deletions core-java-modules/core-java-string-operations/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<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-operations</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>core-java-string-operations</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.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmh-core.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh-generator.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons-codec.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<finalName>core-java-string-operations</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>

<properties>
<commons-lang3.version>3.8.1</commons-lang3.version>
<assertj.version>3.6.1</assertj.version>
<commons-codec.version>1.10</commons-codec.version>
</properties>

</project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.string.isnumeric;
package com.baeldung.isnumeric;

import java.util.concurrent.TimeUnit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.string.isnumeric;
package com.baeldung.isnumeric;

import java.util.Scanner;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.string.isnumeric;
package com.baeldung.isnumeric;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.string.isnumeric;
package com.baeldung.isnumeric;

import org.apache.log4j.Logger;

Expand Down
Loading

0 comments on commit ba50a42

Please sign in to comment.