forked from eugenp/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move articles out of java-strings part4
- Loading branch information
1 parent
994651a
commit ba50a42
Showing
55 changed files
with
299 additions
and
340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
2 changes: 1 addition & 1 deletion
2
...string/emptystrings/EmptyStringCheck.java → ...eldung/emptystrings/EmptyStringCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...g/emptystrings/Java5EmptyStringCheck.java → ...g/emptystrings/Java5EmptyStringCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...ptystrings/PlainJavaBlankStringCheck.java → ...ptystrings/PlainJavaBlankStringCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...mptystrings/SomeClassWithValidations.java → ...mptystrings/SomeClassWithValidations.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 29 additions & 29 deletions
58
...tring/changecase/ToLowerCaseUnitTest.java → ...ldung/changecase/ToLowerCaseUnitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} |
58 changes: 29 additions & 29 deletions
58
...tring/changecase/ToUpperCaseUnitTest.java → ...ldung/changecase/ToUpperCaseUnitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} |
18 changes: 7 additions & 11 deletions
18
...ng/emptystrings/EmptyStringsUnitTest.java → ...ng/emptystrings/EmptyStringsUnitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...eCase/StringEqualsIgnoreCaseUnitTest.java → ...eCase/StringEqualsIgnoreCaseUnitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
...ization/StringInitializationUnitTest.java → ...ization/StringInitializationUnitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...baeldung/StringConcatenationUnitTest.java → ...tenation/StringConcatenationUnitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
2 changes: 1 addition & 1 deletion
2
...eldung/string/isnumeric/Benchmarking.java → .../com/baeldung/isnumeric/Benchmarking.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...g/string/isnumeric/CheckIntegerInput.java → ...baeldung/isnumeric/CheckIntegerInput.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
.../baeldung/string/isnumeric/IsNumeric.java → ...ava/com/baeldung/isnumeric/IsNumeric.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ung/string/isnumeric/IsNumericDriver.java → ...m/baeldung/isnumeric/IsNumericDriver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
|
Oops, something went wrong.