Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
13 views3 pages

Milestone1-String StringBuffer

Uploaded by

2100090155csit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

Milestone1-String StringBuffer

Uploaded by

2100090155csit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

String,StringBuffer

Learning Material for String,StringBuffer


Below is the learning material that you are expected to read along with completion of the hands-on
assignments. The material is mentioned in the order in which it should be read.

Type of
No Material Title Material Location Materia Classification
l

1 String,StringBuffer TM2_String_StringBuffer.pdf PDF Mandatory


2 String,StringBuffer http://docs.oracle.com/javase/7/docs/api/java/lang/String.html Web Suggestive
3 String,StringBuffer https://docs.oracle.com/javase/7/docs/api/java/lang/StringBuffer.html Web Suggestive
2 String http://www.tutorialspoint.com/java/java_strings.htm Web Suggestive
3 StringBuffer http://www.tutorialspoint.com//java/lang/java_lang_stringbuffer.htm Web Suggestive

Hands-on Assignments for String,StringBuffer


Complete the below hands-on assignments before proceeding with the next Topic

Update Completion Status

No. Hands-on Assignment Topics Covered Status

Write a Program that will check whether a given String is


1 Palindrome or not String/StringBuffer

Given two strings, append them together (known as


"concatenation") and return the result. However, if the
2 concatenation creates a double-char, then omit one of the String/StringBuffer
chars. If the inputs are “Mark” and “Kate” then the ouput
should be “markate”. (The output should be in lowercase)

Given a string, return a new string made of n copies of


the first 2 chars of the original string where n is the
length of the string. The string may be any length. If
3 there are fewer than 2 chars, use whatever is there. String/StringBuffer
If input is "Wipro" then output should be "WiWiWiWiWi".

Given a string of even length, return the first half. So


4 the string "CatDog" yields "Cat". If the string length is String/StringBuffer
odd number then return null.
Given a string, return a version without the first and
5 last char, so "Wipro" yields "ipr". The string length will String/StringBuffer
be at least 2.

Given 2 strings, a and b, return a string of the form


short+long+short, with the shorter string on the outside
and the longer string on the inside. The strings will not
6 be the same length, but they may be empty (length 0). If String/StringBuffer
input is "hi" and "hello", then output will be
"hihellohi".

Given a string, if the first or last chars are 'x',


return the string without those 'x' chars, and otherwise
7 return the string unchanged. If the input is "xHix", then String/StringBuffer
output is "Hi".

Given two strings, word and a separator, return a big


string made of count occurrences of the word, separated by
the separator string.
8 String/StringBuffer
if the inputs are "Wipro","X" and 3 then the output is
"WiproXWiproXWipro".

Return a version of the given string, where for every


star (*) in the string the star and the chars immediately
9 to its left and right are gone. So "ab*cd" yields "ad" and String/StringBuffer
"ab**cd" also yields "ad".

Given two strings, a and b, create a bigger string made


of the first char of a, the first char of b, the second
char of a, the second char of b, and so on. Any leftover
10 chars go at the end of the result. String/StringBuffer
If the inputs are "Hello" and "World", then the output is
"HWeolrllod".

Given two strings, a and b, create a bigger string made


of the first char of a, the first char of b, the second
11 char of a, the second char of b, and so on. Any leftover String/StringBuffer
chars go at the end of the result. If input is “abc” and
“xyz”, then output should be “axbycz”.
Given a string and an int n, return a string made of n
repetitions of the last n characters of the string. You
12 may assume that n is between 0 and the length of the String/StringBuffer
string, inclusive. For example if the inputs are “Wipro”
and 3, then the output should be “propropro”.

Given a string and a non-empty word string, return a


string made of each char just before and just after every
appearance of the word in the string. Ignore cases where
there is no char before or after the word, and a char may
be included twice if it is between two words.

13 String/StringBuffer
If inputs are "abcXY123XYijk" and "XY", output should be
"c13i".
If inputs are "XY123XY" and "XY", output should be "13".
If inputs are "XY1XY" and "XY", output should be "11".

You might also like