substring

    044 - Method Header Challenge 1 (Optional)

    044 - Method Header Challenge 1 (Optional)

    Write a method header on line two with the following specs: Returns: a String Name: mixString Parameters: a String called s1 a String called s2 Then, starting on line 4, write code that will return the strings combined, one letter at a time, starting with s1. See example below for an example. You can assume that s1 and s2 are equal lengths: s1 ==> "12345" s2 ==> "abcde" mixString(s1,s2) ==> "1a2..

    011 - String Methods Practice 2

    011 - String Methods Practice 2

    Given three variables: String str int start int end Print out the following string: The substring of (str) from (start) to (end) is (substring from start to end, inclusive) Sample output: In: lolwut Start: 2 End: 4 The substring of lolwut from 2 to 4 inclusive is lwu PLEASE NOTE that we are counting the end index in our output! lolwut 012345 import java.util.Scanner; class Main { public static v..

    010 - String Methods Practice 1

    010 - String Methods Practice 1

    Given a String (already declared for you as str), do the following: Print out the following: "The first 3 letters of ___ is ___" For example, if the input is "banana", your output should be "The first 3 letters of banana is ban" import java.util.Scanner; class Main { public static void main(String[] args) { Scanner inp = new Scanner(System.in); System.out.print("in:"); String str = inp.nextLine(..

    009 - String Methods - substring

    009 - String Methods - substring

    For you to do: (all output should be one per line) On line 6, write a print statement that prints out a substring of str starting at index 5 and going to the end On line 7, write a print statement that prints out a substring of str starting at index 7 and ending at index 10 On line 10, fill in the () in substring so that it prints "harambe" On line 11, fill in the () in substring so that it prin..