if i want to print perticular string multiple no. of times .

if i want to print perticular string multiple no. of times . and if that number is varies dyanamically then how to do it ?

while(x.find()&& !m.find()){

int last=x.end();

int first= x.start();

int indx=last-first;

p.println("Last index is " +last);

p.println("first index is " +first);

String trg=targetSegment.replaceAll(ReGeX," ");// here i am stuck ..

I want to replace as many no. of times as that indx variable value is ..

How to do that

plzzzzz help

[800 byte] By [AmitChalwade123456a] at [2007-11-27 10:55:11]
# 1

Don't use replaceAll but replaceFirst?

CeciNEstPasUnProgrammeura at 2007-7-29 11:54:44 > top of Java-index,Java Essentials,Java Programming...
# 2

it did not work .. i need

If index is 5 then it should replace (string * 5) times

if index id 10 then it should replace (string * 10) times

How to achieve this ?

AmitChalwade123456a at 2007-7-29 11:54:44 > top of Java-index,Java Essentials,Java Programming...
# 3

I don't understand at all what you need. How much is "string * 5"?

CeciNEstPasUnProgrammeura at 2007-7-29 11:54:44 > top of Java-index,Java Essentials,Java Programming...
# 4

Say suppose if index is 2 then it should print "amitamit" that means two times amit .. Noe if index is 3 then it should print "amitamitamit" that means 3 times amit is printed ..

Like that i want according to index value printing of perticular string should change

Help plzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

AmitChalwade123456a at 2007-7-29 11:54:44 > top of Java-index,Java Essentials,Java Programming...
# 5

> Say suppose if index is 2 then it should print

> "amitamit" that means two times amit .. Noe if index

> is 3 then it should print "amitamitamit" that means 3

> times amit is printed ..

> Like that i want according to index value printing

> of perticular string should change

>

> Help plzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

First: stop signing your post with that crap! We know you need help: that's why you're posting here.

Now your question: ok, you would like to print a certain string a number of times. Could you provide some sample in- and (desired) output because I have no idea by looking at the code from your original post what it is you're trying to do.

Also, please explain what this is supposed to do: while(x.find()&& !m.find())

prometheuzza at 2007-7-29 11:54:44 > top of Java-index,Java Essentials,Java Programming...
# 6

Amit, meet StringBuilder. StringBuilder, this is Amit. I think you'll get along just fine. If you need anything else, please consult someone called "for loop".

CeciNEstPasUnProgrammeura at 2007-7-29 11:54:44 > top of Java-index,Java Essentials,Java Programming...