regular expression

hii have some quetion about regular expression.I have number 905544.with regular expression 905544.replaceAll("(.)(?!$)","$1 ");i have 9 0 5 5 4 4 but i want two or three tabs between numbers.if anyone know pleace help me
[228 byte] By [smotan102a] at [2007-11-26 15:21:51]
# 1

> hii have some quetion about regular expression.I

> have number 905544.with regular expression

> 905544.replaceAll("(.)(?!$)","$1 ");i have 9 0 5 5 4

> 4 but i want two or three tabs between numbers.if

> anyone know pleace help me

Hi Friend

I do my level . But there was a problem to converting the string into integer. It dosen't take tab a number. That is the problem.

import java.io.*;

class simple

{

public static void main(String arg[])

{

try{

String num ="905544";

System.out.println(num.charAt(0));

String s1 = num.charAt(0) + "\t";

System.out.println("S1:"+s1);

System.out.println(num.charAt(1));

String s2 = num.charAt(1) + "\t";

System.out.println("S2:"+s2);

System.out.println(num.charAt(2));

String s3 = num.charAt(2) + "\t";

System.out.println("S3:"+s3);

System.out.println(num.charAt(3));

String s4 = num.charAt(3) + "\t";

System.out.println("S4:"+s4);

System.out.println(num.charAt(4));

String s5 = num.charAt(4) + "\t";

System.out.println("S5:"+s5);

System.out.println(num.charAt(5));

String s6 = num.charAt(5) + "\t";

System.out.println("S6:"+s6);

String result = s1+s2+s3+s4+s5+s6;

System.out.println("result:"+result);

int number = Integer.parseInt(result);

System.out.println("Integer Number:"+number);

}

catch(Exception e){

System.out.println("Exception for... :"+e);

}

}

}

ggopia at 2007-7-8 21:36:49 > top of Java-index,Java Essentials,Java Programming...
# 2
> hii have some quetion about regular expression.I> have number 905544.with regular expression> 905544.replaceAll("(.)(?!$)","$1 ");Why aren't you adding tab to the replacement string in that case?
kajbja at 2007-7-8 21:36:49 > top of Java-index,Java Essentials,Java Programming...
# 3
This is how you do that if you don't know:String result = "905544".replaceAll("(.)(?!$)","$1\t");Kaj
kajbja at 2007-7-8 21:36:49 > top of Java-index,Java Essentials,Java Programming...
# 4
in this case i have only one tab between numbers.I want two or three tab between numbers
smotan102a at 2007-7-8 21:36:49 > top of Java-index,Java Essentials,Java Programming...
# 5
> in this case i have only one tab between numbers.I> want two or three tab between numbersWow! I wonder how one can solve this? Does one use one's brain or does one wait until someone else shows how it should be done?
sabre150a at 2007-7-8 21:36:49 > top of Java-index,Java Essentials,Java Programming...
# 6

> > in this case i have only one tab between numbers.I

> > want two or three tab between numbers

>

> Wow! I wonder how one can solve this? Does one use

> one's brain or does one wait until someone else shows

> how it should be done?

LOL.

@Op. What do you think you need to change in my post?

kajbja at 2007-7-8 21:36:49 > top of Java-index,Java Essentials,Java Programming...