Jump to content

Java Replace Method

Recommended Posts

How do I make functionalArea case insensitive, so that the following code will replace any variation of the world "java" whether its "JAVA, java, Java, jAva" etc? Or do I need a completely different approach?

String functionalArea = "Java";String skillset = "This is some really long string that will contain the word Java in it. Or it could be java.";String foundSkill = "<span style='color:red;'>"+functionalArea+"</span>";skillset = skillset.replace(functionalArea, foundSkill);

Any help would be appreciated. I'm a Java newb. =)

Edited by big dave

Share this post

Link to post
Share on other sites

Not to familiar with jsp but if you want to do that you may have to use a combination of regular expressions with conditional statements.This is a 1000 times easier with php as there are built in functions for this. I think the String API may have some methods to help you:String Api

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...