Can replaceAll do what I want?

Hi
I have a string "This is My string my way"
This text will be in a button's text property.
What I would like to do is add a html tag like the font tag to certain parts of the string to make it another color.
The user will for instance provide the input "my" ,all input will be lowercase.
Then it should add the following tag to the string : "This is <font>My</font> string <font>my</font> way"
This should be done for all matching strings upper and lower case.
I had a look at replaceAll, but it will replace only the exact string so if the input is lowercase it won't be replaced. I also need to retain the case of the "replaced" string so that "My" does not change to "<font>my</font>"
Can replaceAll be used to do what I want?
Some examples would be appreciated.
Thanks

The first argument to replaceAll() is a regular expression, which means you can do a lot more than just match case-insensitively, but here's how you would do that:  String str2 = str1.replaceAll("(?i)my", "<font>$0</font>");You might find these links useful:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html
http://www.regular-expressions.info/

Similar Messages

  • I recently installed an app CARTOON HD. I stupidly clicked install as I read that it wants access to my protected data. How can I see what it wants access to and how do I delete it

    I recently installed an app CARTOON HD. I stupidly clicked install as I read that it wants access to my protected data.... I think.  How can I see what it wants access to and how do I delete it

    How do I delete it permanently if it has indeed requested my protected/personal data?

  • When I open iTunes my iPod nano does not appear in the list of divides so that I can click on what I want to since.

    When I connect my Ipod Nano to my Mac it does not appear in the list of devices, so I can't check what I want it to sinc, such as music videos. It will sinc thr music automaticlly. I can't tell it to sinc anything else.

    the same exact thing happens to me except that when i plug it in it tells me not to disconnect it. i had a friend who told me to leave it plugged in no matter how long it took.. i waited for 5 hours or more for my ipod to do something and i got so mad i just disconnected it.it didn't do ANYTHING AT ALL. so, if someday you find out how to make yours work.. can you tell me please? i'm desperate!
      Windows XP  

  • Family account: Can we set it up so that each kid can only download what they want?

    I have two kids. I'd like a family account. Older kid doesn't want apps and music that younger kid wants. Can we set it up so that each kid can only download what they want? Furthermore, can I set it up so that kids can only download things I approve?
    <Re-Titled By Host>

    Have a look at this. Exactly what you are asking about > Family Sharing - Apple Support
    ÇÇÇ

  • Erase and install - Can I select what I want to put back on from Time Machine.

    I've been suffering from the super slow Yosemite problem. I have had two long sessions with the very nice people on Apple support and have we have made some progress - thank you Marie and Cheryl. They have suggested an 'erase and install' to resolve the problem.
    I regularly back up my laptop to 'Time Machine' but I don't want to just reload everything as that may just bring the problem back again. So, the question is can I select which files and applications I want to recover from Time Machine?

    Here's what you should do:
    Install or Reinstall Lion/Mountain Lion from Scratch
    Be sure you backup your files to an external drive or second internal drive because the following procedure will remove everything from the hard drive.
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Erase the hard drive:
      1. Select Disk Utility from the main menu and click on the Continue button.
      2. After DU loads select your startup volume (usually Macintosh HD) from the
          left side list. Click on the Erase tab in the DU main window.
      3. Set the format type to Mac OS Extended (Journaled.) Optionally, click on
            the Security button and set the Zero Data option to one-pass. Click on
          the Erase button and wait until the process has completed.
      4. Quit DU and return to the main menu.
    Reinstall Lion: Select Reinstall Lion/Mountain Lion and click on the Install button.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible
                because it is three times faster than wireless.
    Once you know it's running properly you can begin re-installing your third-party software from the original media. Finally, restore your data from your Time Machine backup. This assures that all but your data files are freshly installed.

  • Running Total Fields - using formula, but can't get what i want?

    Hi All,
    I have already searched some forum, but still can't figure out what going wrong. Can anyone help me?, please
    I create a view from access named u201CStatementReportu201D and have the following field.
    <InvNo>
    <CustNameC>
    <JobItemNo>
    <InvDate>
    <JobTypeId>
    <JobPrice>
    I create three parameter as CustName, StartDate, EndDate, then I create a Group to group <InvNo> as the report detail and a Running Total Fields for calculate the total of <JobPrice>.
    So far the report is fine. Showing the grouped <InvNo> and the total amount of <JobPrice>
    Then, I want to calculate the <JobPrice> by the condition of <JobTypeId>.
    First, I create a new Running Total Fields
    Field to summarize = StatemetnReport.JobPrice
    Type of summary = sum
    Second, I create a formula as following
    whileprintingrecords;
    global numbervar type1_sum :=0 ;
    if {statementRe.JobTypeId} = 1 then
        type1_sum := type1_sum + {statementRe.JobPrice};
    type1_sum;
    After completed the formula, and i press Ok button.
    A dialog appear "Warning: Reset/evaluate condition formula contains variables. Do you want to keep it?"
    No matter i click Yes or No, I still can't get anything display on the field.
    Edited by: manho88 on Mar 9, 2010 9:42 AM

    Hi,
    Instead of running total use can try this formula.
    Place this formula in the details section.
    whileprintingrecords;
    numbervar jpsum;
    if =111 then
    jpsum:=jpsum +
    else 0;
    You can modify this formula as per your requirement.
    Hope this helps.

  • Can I do what they want?

    So I got a small non-paying volunteer internship.  I told them that I was learning Dreamweaver for school, and before I know what hit me they think I am some sort of genius and are always calling me over to help with there computer problems.  I have been lucky because until now the biggest problem has been a cable has been loose and no one could figure it out but me.  (I really am not joking)
    But now, the previous computer guy, who is leaving, sent me an e-mail with things I don't know anything about.  Yes I would like to learn, but I do not know where to start.  The person in charge says she wants to be able to make small changes without it being a hassle, because I am going to be gone in 9 months.  So she is still going to want make small changes after I leave. 
    The gist of what the other computer guy sent me is:
    login information is FTP (File Transfer Protocol)
    good program for this is iFTP (http://www.memecode.com/iftp.php)
    I mean this is beyond Dreamweaver, please somebody tell me where to start, or some options other than leaving. 
    Thank you.  Please Help Me.
    ohh... I have CS3 if that matters. 

    It sounds as if Computer Guy is suggesting that you use a separate FTP program to upload your files.
    That is not necessary. Once you have your remote access settings, just put them into your site definition and you can FTP right inside Dreamweaver.
    There are lots of good help pages for this kind of thing. In Dreamweaver, to get a contextual help page, just click on the Help button on a dialog box or press the Help menu button at the top of the program window.
    Beth

  • TS1425 When I try to select music the bottens don´t go, so I can´t chose what I want. Do I need to send it in to be looked at?

    My I Pod buttons are´nt working, what should I do?

    Make sure the Hold switch is not in the ON position.
    If that's not it, see if you can do a Reset (restart) on the iPod
    http://support.apple.com/kb/ht1320
    If that does not help, does the iPod still appear in iTunes when connected?

  • New iPhoto user: Can it do what I want it to do?

    I have just discovered iPhoto on my iMac. I want to create a slideshow, with several songs, and with a caption for each photo, or even on each photo. The photos will be in a particular order to tell a story. Then I want to save it in some format and send it electronically to a friend who only has a PC with Windows.
    I have figured out how to create a slideshow, but not how to add captions (except by Photoshopping). Nor have I figured out a way for anyone who does not have iLife or a .Mac account to see my fabulous creation.
    How do others do this?

    altofiddler
    but not how to add captions (except by Photoshopping)
    Can't be done in iPhoto, you'll need the photoshopping. You can set Photoshop as an external editor in iPhoto. (Preferences -> General -> Edit Photo: Choose from the Drop Down Menu.) This way, when you double click a pic to edit in iPhoto it will open automatically in Photoshop, and when you save it it's sent back to iPhoto automatically.
    Nor have I figured out a way for anyone who does not have iLife or a .Mac account to see my fabulous creation.
    Select the Slideshow and go File -> Export and export it as a quicktime movie. You can email, upload to the web, burn to a disk... using the Share -> Send to iDVD command, you can make a DVD that will play on any DVD player.
    Regards
    TD

  • Can I change what I want synced across different devices on the same Apple ID?

    Good evening everyone,
    I purchased a 13" MacBook Pro with MAC OS X Lion, set up the iCloud function and everything worked well.  I have recently purchased a 17" MacBook Pro MAC OS X Lion also and want to be able to sync my Calendars with my iPhone.  I do however want to find out if it is possible to change the settings on my 13" Laptop so that nothing else but music is stored in my cloud since I use it solely for the purpose of DJing.  I want my 17" only for scheduling and keeping track of my interpreting business information.  Is this possible without screwing up my iCloud too much?
    Thanks,
    Juan

    Figured it out...thanks though ahead of time.

  • I can not seem to update to the new version of fire fox because I am running a mac osx 10.4.2 and I can not view what I want to in the old fire fox. What to do

    I have a mac lap top from 2007. When I try to down load fire fox, I get a message telling me mac os x 10.4.2 does not support the new fire fox. Is there something else I can do? Thank you!

    See - https://support.mozilla.org/en-US/kb/firefox-no-longer-works-mac-os-10-4-or-powerpc
    You can try TenFourFox:
    *http://www.floodgap.com/software/tenfourfox/
    *No Flash or Plugin support in TenFourFox (read completely) - https://code.google.com/p/tenfourfox/wiki/ReleaseNotes1007
    You can use another browser.

  • Can't find what I want

    To learn more about "split()" and "ArrayList", I go to the page:
    http://java.sun.com/j2se/1.4.2/docs/api/,
    but couldn't see the things I want.
    Could anyone tell me where are these two things located?

    You're about to learn a vital skill: browsing the Java API Documentation.
    so... you have a few options.
    1. browse the packages and find the documentation for the classes and methods you want. This will have you learn a lot as you go along, about the Java language package system and Object hierarchy.
    2. Type in the term you are searching for over here: http://java.sun.com/docs/search.html. You may also learn about aforementioned as you do this, but probably not as much.
    3. Download the docs for yourself, and use them on your own machine, without having to use the net all the time to look up. I won't spoonfeed you that link.
    4. There are also some Compiled Help files available around for Java; these are pretty nifty. Google is your friend.
    Good luck!

  • When is gaikai coming to iOS devices cause I'm getting kind of ticked with the same fake lie, gaikai is soon coming to iOS devices crap. What kind of service is this if you can't get what you want when you apparently want it? Apple, do something!

    Apple devices always says for gaikai, "gaikai coming soon to iOS devices" but I have had this iPad for 2generations (updates) iOS 6 and 5 yet there is no change to the same excuse. I smell something fishy and I am getting irritated with the same excuse. Just give people the gaikai folks!
    It's easy as abc and 123. I do not want to erase my contents and sell this device for this cause. Please give the gaikai for the sake of sim lovers out there!

    Contact the Gaikai developers. It isn't apple your mad at

  • CPK order - can't do what I want it to!

    Hi,
    I'm putting together a package to install Dell OpenManage agents on my NW
    6.5 servers.
    I have made 2 components:
    Component 1:
    1. Stop the existing agents
    2. Uninstall the existing agents
    3. Copy the installation files to a temp directory
    4. Replace the start/stop NCFs with new ones
    5. Delete the old Dell directories
    6. Install the new agents (a post install action calling a Dell NCF silent
    install)
    Component 2:
    1. Modify the AUTOEXEC.NCF load order
    2. Delete the temp install directory
    3. Restart the server
    The problem is that component 2 runs while the silent install of the
    agents (Setp 6, Component 1) is running.
    I have tried having component 2 have a requirement that the PRODUCTS.DAT
    must have the entry for the new agents, but as it runs while the silent
    install is running, the enrty is not there, therefore component 2 does not
    execute.
    How can I make component 2 execute after the silent install in component 1
    has finished?
    Cheers,
    Dennis.

    Dennis,
    It appears that in the past few days you have not received a response to your posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Do a search of our knowledgebase at http://support.novell.com/search/kb_index.jsp
    - Check all of the other support tools and options available at http://support.novell.com in both the "free product support" and "paid product support" drop down boxes.
    - You could also try posting your message again. Make sure it is posted in the correct newsgroup. (http://support.novell.com/forums)
    If this is a reply to a duplicate posting, please ignore and accept our apologies and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://support.novell.com/forums/

  • Can I filter what apps can be downloaded to my iPad?

    Filtering apps for download..... Can I limit it?

    I will take another approach .....
    If you use Automatic Downloads and you are downloading on another iOS device - those apps will download to the iPad as well. You cannot select only certain apps to download across devices - unless of course you turn off Automatic downloads.
    Now that's two different interpretations of your post. Perhaps you can explain exactly what you want to know.

Maybe you are looking for