Write a function in Java that implements the following logic: Given a string, return a string made of its first 2 chars. If the string...
Search Results
Searching for: strings
Individual Exercises
Write a function in Java that implements the following logic: Given a string, return a string of length 1 from its front, unless front
is...
Given a string, if the same 2-character substring appears at both its beginning and end, return the contents of the string without the...
Given a String str
and a character ch
, return the number of times ch
appears in str
. For example, if str
is "Hello" and ch
is 'l', the...
Given an array of String
s, return a single String
that is made up of all strings in the array concatenated together in order. For...
Given an array of String
s, return a single String
that is made up of all strings in the array concatenated together in reverse order. For...
Given a String
, return an array of char
values that contains the characters of the string in reverse order. For example, if the string is...
Given two strings of equal length, return an array of char
values that contains the characters of the strings in alternating order. For...
Given a string str
and an int n
, return a string made of the first n
characters of the string, followed by the first n - 1
characters of...
[Based on an exercise at https://codeworkout.cs.vt.edu/]
Given an array of Strings, return a single String that is made up of all strings...
Complete the function countStrLongerThan()
so that it returns the count of Strings in the array names
that are longer than minLen
. You...
Complete the function countStrings()
so that it returns the count of Strings in the array names
that are not null
.
Complete the function countStrLongerThan()
so that it returns the count of Strings in the array names
that are longer than minLen
. You...
Complete the function joinStrings()
so that it returns a string with all the strings in words
concatenated. You should use sep
as a...
Complete the function joinStrings()
so that it returns a string with all the strings in words
concatenated. You may assume that the array...
Write a method that reverses the contents of the given string array contents
returning an ArrayList<String>
with the resutts. If...
Complete the function countStrLongerThan()
so that it returns the count of Strings in the ArrayList<String> names
that are longer...
Complete the function removeStrLongerThan()
so that it removes from strings in the ArrayList<String> names
that are longer than ...
Say that a "character clump" in a string is a series of 2 or more adjacent copies of the same character. Return the number of character...
Implement the following method so that it counts the number of times the target
character appears in the given string and returns the...
Complete the calculatePrice
function so that each item in the provided cart
added to the total price. Any item that is "milk"
costs $2.50...
Complete the following function. When given aString, return True if it ends in "ly". Return False otherwise.
Complete the following function. Given aString, return the first half of characters in that string (the string "woohoo" yields "woo")....
Complete the following function. Given aString, return a copy of aString where any character next to a star (*) and all stars themselves...
Given an outside string of length 4, such as "(())"
, and an inside string, return a new string where the inside is squeezed in the middle...