Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Boell Fischer   on May 18 In Java Category.

  
Question Answered By: Antonio Dunn   on May 18

here's my type of code, is'nt it simple??

class Charactering
{
public static void main(String args[])
{
String name = "23AM";
char c;
String a="", b="";
for(int i=0; i< name.length(); i++)
{
c=name.charAt(i);
if ( Character.isDigit(c))
{
a += c;
continue;
}
else
{
b+=c;
}
}
System.out.println(a);
System.out.println(b);
}
}

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on tokenize name to 23 and PM separately Or get search suggestion and latest updates.


Tagged: