0

wap to print first three and last three char of string.

31st Aug 2016, 3:54 AM
padmesh
padmesh - avatar
2 Respostas
+ 2
str.at(0) str.at(1) For the first three str.at(2) str.at(str.length() - 1) str.at(str.length() - 2) For the last three str.at(str.length() - 3)
31st Aug 2016, 11:57 AM
Cohen Creber
Cohen Creber - avatar
0
Take 2 string variables.Say str1 and str2 store the string in str1.Then use the code str2=str1.substring(starting index value,3rd index value)+str1.substring(3rd last index value,last index value).Then print str2.
31st Aug 2016, 4:04 AM
Akshay Kamat
Akshay Kamat - avatar