Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.
Acromatic string converter - Java Code Bank
Acromatic string converter
a program that takes a string from the user (containing spaces ) , e.g , a name and displays output in the following way:-
sample input - leonel messi
sample output - l.messi
import javax.swing.*;
public class acromatic_string
{
public static void main (String args[])
{
String a = ((String)JOptionPane.showInputDialog("Enter name (of any length) :") ).trim();
String dis="";
a=" "+a;
int sp = a.lastIndexOf(' '); //finding last space
String last = a.substring(sp+1); //pick up the last word
for(int i = 0 ; i < sp;i++)
{
if(a.charAt(i)==' ') //finding space and pick up the letter after spaces
dis = dis+a.charAt(i+1)+".";
}
JOptionPane.showMessageDialog(null, dis+last, "acromatic string ", JOptionPane.PLAIN_MESSAGE);
}
}
Comments
Sorry but there are no comments to display