Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 text repetition
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ahmhum




PostPosted: Mon Mar 10, 2008 1:39 pm   Post subject: text repetition

can anyone help me with a text repetion
thnx Smile
Sponsor
Sponsor
Sponsor
sponsor
OneOffDriveByPoster




PostPosted: Mon Mar 10, 2008 1:51 pm   Post subject: Re: text repetition

Describe what text repetition is... echoing back?
richcash




PostPosted: Mon Mar 10, 2008 2:45 pm   Post subject: RE:text repetition

Maybe he means creating a string by using a repeating substring, such as the repeat function in turing.

I don't know any predefined method to do that in java, but you could use a for loop and/or define your own method. Using StringBuffer and then converting to String at the end might be more efficient.
A.J




PostPosted: Mon Mar 10, 2008 5:54 pm   Post subject: Re: text repetition

richcash wrote:

Maybe he means creating a string by using a repeating substring, such as the repeat function in turing.

I don't know any predefined method to do that in java, but you could use a for loop and/or define your own method. Using StringBuffer and then converting to String at the end might be more efficient.

yup, richcash is right.
using string buffer and then converting it to string at the end IS INDEED more efficient!
But elaborate on 'text repetition' please,ahmhum, so then we can see your code or whatever it is and help you out Very Happy
ahmhum




PostPosted: Mon Mar 10, 2008 9:35 pm   Post subject: RE:text repetition

i am trying to make the numbers repeat
just like from the movie matrix
A.J




PostPosted: Mon Mar 10, 2008 10:49 pm   Post subject: Re: text repetition

In that case I have a PERFECT example in turing.
but the main idea is that you have a string for random digits (say '1031234874...' for example),
then you just keep outputting that string in a cool color in a cool background!!!!!
ahmhum




PostPosted: Mon Mar 10, 2008 11:57 pm   Post subject: Re: text repetition

this is what i have now


Forloop.java
 Description:

Download
 Filename:  Forloop.java
 Filesize:  1.39 KB
 Downloaded:  90 Time(s)

A.J




PostPosted: Tue Mar 11, 2008 9:44 am   Post subject: Re: text repetition

It looks good Very Happy
so what is the problem with it?
Sponsor
Sponsor
Sponsor
sponsor
ahmhum




PostPosted: Tue Mar 11, 2008 3:22 pm   Post subject: RE:text repetition

i can't put another text on top of it cuz the numbers cover it up
ahmhum




PostPosted: Tue Mar 11, 2008 3:31 pm   Post subject: Re: text repetition

this is what happens


Forloop.java
 Description:

Download
 Filename:  Forloop.java
 Filesize:  2.21 KB
 Downloaded:  79 Time(s)


Forloop.java
 Description:

Download
 Filename:  Forloop.java
 Filesize:  2.21 KB
 Downloaded:  107 Time(s)

A.J




PostPosted: Tue Mar 11, 2008 3:46 pm   Post subject: Re: text repetition

when you add the second line of numbers, just add a line of space before it! doesn't that work?
for example:
code:

add -> "1031234234432..."
add -> "                         "
           "1031234234432..."
add -> "                         "
           "                         "
           "1031234234432..."
etc...

so the output should look like:
code:

1031234234432...
1031234234432...
1031234234432...
etc...
Nick




PostPosted: Tue Mar 11, 2008 5:35 pm   Post subject: RE:text repetition

wouldn't \n also work?
A.J




PostPosted: Tue Mar 11, 2008 6:14 pm   Post subject: Re: text repetition

sure (way to go by finding a better method Evil or Very Mad )
ahmhum




PostPosted: Tue Mar 11, 2008 11:34 pm   Post subject: RE:text repetition

the problem can be solved by moving the string text
but i don't know how to do that
so can anyone tell me how to move an object
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 14 Posts ]
Jump to:   


Style:  
Search: