Please help me friends
I have a doubt in using array in JAVA
if my input is AB1CD
They are stored in array as
a[0]=A
a[1]=B
a[2]=1
a[3]=C
a[4]=D
I developed a coding to insert the number that appearing after a alphabet in the same array element like
a[0]=A
a[1]=B1
a[2]=C
a[3]=C
a[4]=D
The program is given below
import java.io.*;
class suba
{
public static void main(String args[]) throws IOException
{
String[] st= new String[100];
System.out.println("Enter the text :");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String str=br.readLine();
st=str.split("");
for(int k=0;k<(st.length-1);k++)
{
st[k]=st[k+1];
}
//char ch[]=str.toCharArray();
for(int i=0;i<st.length-1;i++)
{
if((st[i].equals("0"))||(st[i].equals("1"))||(st[i].equals("2"))||(st[i].equals("3"))||(st[i].equals("4"))||(st[i].equals("5"))||(st[i].equals("6"))||(st[i].equals("7"))||(st[i].equals("8") )||(st[i].equals("9") ) )
{
st[i-1]=(st[i-1]+st[i]);
st[i]=st[i+1];
}
}
for(int j=0;j<st.length-1;j++)
{
System.out.println("A["+j+"]"+st[j]);
}
}
}
My problem is that i want to move the next consecutive element appearing after the number to array element of the number position. fr ex like
a[0]=A
a[1]=B1
a[2]=C
a[3]=D
I getting repeated alpabet and not able to delete the last position tat was unoccupied. Someone please help with it. Thanks fr ur help...... :) :)