aspose file tools*
The moose likes Beginning Java and the fly likes replaceAll() and images Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "replaceAll() and images" Watch "replaceAll() and images" New topic
Author

replaceAll() and images

Taylor Swift
Greenhorn

Joined: Feb 23, 2009
Posts: 5
http://evercube.net/forum/ftb2meme.php

Take a look a that generator. You will notice there is a code table for it.



I need it so when the input {tri} it displays as down in "This is how it'll look in game:". Image: http://evercube.net/images/trianglebutton.png.


I have been able to do text replacement color using the following:


Here is an example image:


Any ideas for images to replace text?

Piet Verdriet
Ranch Hand

Joined: Feb 25, 2006
Posts: 266
Why are you including those curly brackets ('{' and '}') in your patterns?
Why not just use String's replace(...) method?

But what "real" problem are you trying to solve here?
Taylor Swift
Greenhorn

Joined: Feb 23, 2009
Posts: 5
Piet Verdriet wrote:Why are you including those curly brackets ('{' and '}') in your patterns?
Why not just use String's replace(...) method?

But what "real" problem are you trying to solve here?


http://evercube.net/forum/ftb2meme.php

When they put in {*0} Color is generated as how it will look in game. I need it to do the same when they put in {tri} but instead of color it is an image.
Piet Verdriet
Ranch Hand

Joined: Feb 25, 2006
Posts: 266
Taylor Swift wrote:
Piet Verdriet wrote:Why are you including those curly brackets ('{' and '}') in your patterns?
Why not just use String's replace(...) method?

But what "real" problem are you trying to solve here?


http://evercube.net/forum/ftb2meme.php

When they put in {*0} Color is generated as how it will look in game. I need it to do the same when they put in {tri} but instead of color it is an image.


I really have no idea what you're trying to do. What text are you working with? I thought you wanted to replace the underlined part from the text:

http://evercube.net/images/trianglebutton.png

If this is not the case, try explaining your problem again.

Good luck.
Taylor Swift
Greenhorn

Joined: Feb 23, 2009
Posts: 5
http://evercube.net/forum/ftb2meme.php

Take a look a that generator. Going to spell this one out. You will notice this:




When you input {*1}hello into the generator. It gives you a code for that text for the game. At the bottom, it also shows you how the code looks in game: hello

I need it so when the input {tri} it displays this image: http://evercube.net/images/trianglebutton.png.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41525
    
  53
I see "innerHTML" , which looks like JavaScript to me. "replaceAll", on the other hand, is a Java method - is this question about Java or JavaScript?

Curly braces and stars have special meaning in regular expressions (which is what replaceAll uses), so you'll need to escape them. Try "\\{\\*1\\}" instead of "{*1}".


Ping & DNS - my free Android networking tools app
Taylor Swift
Greenhorn

Joined: Feb 23, 2009
Posts: 5
Ulf Dittmer wrote:I see "innerHTML" , which looks like JavaScript to me. "replaceAll", on the other hand, is a Java method - is this question about Java or JavaScript?

Curly braces and stars have special meaning in regular expressions (which is what replaceAll uses), so you'll need to escape them. Try "\\{\\*1\\}" instead of "{*1}".


I updated the main thread.

The colors work fine. Try the generator. You will notice on "This is how it'll look in game:" when you put in {tri}, it comes out as {tri} instead of showing an image. When you put in {*1} it shows the text in the color it is suppose too.

Just to clear it up:

COLOR IS NOT THE PROBLEM. I NEED TO REPLACE {tri} TEXT WITH AN IMAGE WHEN PUT INTO THE GENERATOR.

Drew you kids a picture:
Taylor Swift
Greenhorn

Joined: Feb 23, 2009
Posts: 5
any ideas?
Piet Verdriet
Ranch Hand

Joined: Feb 25, 2006
Posts: 266
Taylor Swift wrote:any ideas?


No, because I don't know what exactly you're trying to do and in what language you're doing this. You also didn't answer many of the questions asked to you to clarify your problem.
Perhaps someone else has an idea.
Best of luck though.
 
 
subject: replaceAll() and images