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
@Test | |
void stringLengthEqualToZero() { | |
// Test a string with a length 0. | |
// Test will return true. | |
assertEquals(0, "".length()); | |
} |
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
@Test | |
void stringIsEmpty() { | |
// Test if a String is Empty. | |
// Test will return true because the string is empty. | |
assertTrue("".isEmpty()); | |
} |
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
// Split String By Space Using Limits (return array with three elements) | |
String[] lines = "The Sky Is Blue".split(" ", 2); // ["The", "Sky", "Is Blue"] |
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
// Split String By Space Using Limits (return array with two elements) | |
String[] lines = "The Sky Is Blue".split(" ", 2); // ["The", "Sky Is Blue"] |
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
// Split String By Period | |
String[] number = "012.345.6789".split("\\."); // ["012", "345", "6789"] |
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
// Split String By Space | |
String[] names = "john bob harry".split(" "); // ["john", "bob", "harry"] |
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
// Split String By Comma | |
String[] colors = "red,yellow,green,blue".split(","); // ["red", "yellow", "green", "blue"] |
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
// Split String By Comma | |
String[] colors = "red,yellow,green,blue".split(","); |
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
version: "3" | |
services: | |
# Create a service named db. | |
db: | |
# Use the Docker Image postgres. This will pull the newest release. | |
image: "postgres" | |
# Give the container the name my_postgres. You can changes to something else. | |
container_name: "my_postgres" | |
# Setup the username, password, and database name. You can changes these values. | |
environment: |
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
package main | |
import "fmt" | |
func main() { | |
// Create an slice of 10 integers. | |
numbers := []int{100, 90, 80, 70, 60, 50, 40, 30, 20, 10} | |
// Loop over the slice and print the index and elements. |
NewerOlder