How many times a char showed up in a string

Hi
assume that i have this String:
String s = "I have son and he has son and his son that has a son also"
how can i determine how many times 's' showed up in this string?
thanks

there are many ways to accomplish this goal. All ways will require you to iterate through the String or char array, so the key is probably to simply avoid constructing new String instances on an unnecessary basis. Here is one way to accomplish what you are asking:
for (int x = 0; x < string.length(); x++) {
if (string.charAt(x) == 'i') {
//record this index
list.put(x);

Similar Messages

  • Showing how many times certain data shows up in a table

    How can I show how many times a particular piece of data has
    shown up in a particular field of a table?
    For example, I want to show how many time '1' has shown up in
    playStart field or playerGoal field.

    I want it to show something similar to
    Player Name----------------Appearnces-------Goals
    Where apperances and goals show how many times playerId '1'
    has shown up in the field startPlayerID from the table matchID.
    Similar to
    http://www.welsh-premier.com/sa_club_squad_2005.php?cid=4
    I'd like it to be able to change whenever I update the
    database.

  • HT2589 No matter how many times I've reset my iphone4 and reentered my account information I can't assess my music in iTunes Match or purchase or update any apps or music. How can I fix this. On enabled devices iTunes on my computer shows my iPhone with ?

    I can't access iTunes Match or make any Music or app purchases or updates after updating to iOS 6. No matter how many times I've reset my iphone4 and reentered my account information I can't assess my music in iTunes Match or purchase or update any apps or music. How can I fix this. On enabled devices iTunes on my computer shows my iPhone with ? marks.

    This may help.
    Fix for “No Content” on iPhone & iPod after iOS 4.2.1 update
    The try the standar fixes:
    - Reset. Nothing will be lost.
    Reset iPod touch:  Press and hold the On/Off Sleep/Wake button and the Home
    button at the same time for at least ten seconds, until the Apple logo appears.
    - Restore the iPod from backup via iTues
    - Restore the iPod factoery defaults/new iPod.

  • How many times can I watch a TV Show I've purchased?

    If I buy a season of The Rachel Zoe Project and have it streamed directly to my HD TV, how many times can I watch any given episode.

    Welcome to the Apple Community.
    As many as you want.

  • How many times can you resend an iTunes Gift Card?

    Tried sending an iTunes gift card to a @facebook account but the recipient hasn't received it.
    Is it possible to send to another of their @facebook accounts and if that also fails then to a conventional account?
    I guess my question is how many times can you resend on Gift Card and to how many different email accounts?

    To use an iTune Gift Card to buy books...
    Open iTunes on your computer and click on the iTunes Store.
    You'll need to be signed in...
    Click on the little House icon in the dark gray bar across the top. (or Shift+Command+H)
    On the right side of the page under Quick Links click Redeem and enter your code.
    Then it will show your credit balance in the dark gray bar across the top next to your account name to let you know how much you have to spend.
    Then as you buy books, it'll deduct from the credit balanace.
    There is a distinction between, iTunes Gift Card and Apple Gift Card.
    Apple Gift Card: can be used to purchase Apple hardware and accessories at any Apple Retail Store, the Apple Online Store...
    iTunes Gift Card: To give music, movies, TV shows, apps, books, or anything on the iTunes Store, the App Store, the iBooks Store or the Mac App Store, select an iTunes Gift Card

  • When I go to a website, it takes me to a different one. No matter how many times I open it, it takes me to random sites.

    If I open a page in a tab it will take me to a completely different site, and no matter how many times I try to close and open a new one, it keeps going to different sites. It also happens when I type the website into the address bar, it still takes me to a random site. Is it something with my computer, or is it Firefox, and if it is a problem with Firefox, how do I fix it?

    Sounds like Malware on your PC.
    Install, update, and run these programs in this order. '''''(Not all programs detect the same Malware.)''''' They are all free for personal use, but some have limited functionality in the "free mode" - but those are features you really don't need to find and remove the problem that you have.<br />
    ''Note: If your Malware infection is bad enough and you are mis-directed to URL's other than what is posted, you may have to use a different PC to download these programs and use a USB stick to transfer them to the afflicted PC.''
    Malwarebytes' Anti-Malware - [http://www.malwarebytes.org/mbam.php] <br />
    SuperAntispyware - [http://www.superantispyware.com/] <br />
    AdAware - [http://www.lavasoftusa.com/software/adaware/] <br />
    Spybot Search & Destroy - [http://www.safer-networking.org/en/index.html] <br />
    Windows Defender: Home Page - [http://www.microsoft.com/windows/products/winfamily/defender/default.mspx]
    If these don't find it or can't clear it, post in one of these forums for specialized malware removal help: <br />
    [http://www.spywarewarrior.com/index.php] <br />
    [http://forum.aumha.org/] <br />
    [http://www.spywareinfoforum.com/] <br />
    [http://bleepingcomputer.com]
    Also, the '''''More system details...''''' to the right of your posting shows that you have a few Plugins that need to be updated. See the Mozilla Plugin Check page. <br />
    http://www.mozilla.com/en-US/plugincheck/

  • How many times can I reinstall CS4 if I inactivate it?

    Hello
    How many times can I reinstall CS4 if I inactivate it before I make a new installation on the same computer?
    Regards
    Mikael

    Mikael,
    Not really, because it made me go to slipstreamed installations that proved even better. It takes some time to make a slipstream, but in the end it proves even better IMO. When Win7 comes out, one of my first steps will be to make a slipstreamed version and post a guide here on how to make one tuned to your needs. This is a very old screenshot, way outdated, but it shows what a slipstream installation can do for you:
    Just insert the DVD and have some coffee. When you have finished your coffee and the PC has finished it's installation, you are ready to roll/edit. All tweaks will have been performed, logon scripts executed, etcetera.

  • How many times have I authorized a song?

    Is there a method to see how many times each song I've purchased has been authorized? I just authorized a new album I've just bought (authorized to play on my home computer as well as my work). I received an error message saying I've used 5 of the 5 available slots. This better not be correct as I've only authorized a total of two machines (work and home).
    Is there anyway to verify this?
    Is there anyway to reclaim those missing 3 uses?
    I just upgraded to iTunes 6, could this be the cause?
    And, where did my authorizations go if I can't get them back?
    I'm already contemplating burning a DVD with all of my purchased songs as clean mp3's to avoid losing my investment in my music I've already bought. The fact that I even have to do this shows how hostile this DRM stuff is...

    Carl,
    log into your iTMS account / manage it.
    If you used all of your 5 authorizations your are allowed to de-authorized all of them once a year without accessing each of your authorized computers.
    After that just re-authorize both of computers again.

  • How do I get to see the time and how many times some one has been on a certain website on history?

    I look in to show all history and I can see the history of websites but I want to see the time, date, and how many times been in the websites? How can I can get this information?

    I look in to show all history and I can see the history of websites but I want to see the time, date, and how many times been in the websites? How can I can get this information?

  • How many times a document (item) visited

    Hi,
    is there an option to see / show how many times ,like hit count, a documents viewed by the users? if not, is there anybody who has achieved this,
    Thanks in advance..

    Hi,
    This is very simple job.
    If you want this to be achieved using the JSP use the following code.
    <%!
    int iCount = 0;
    %>
    <%
    iCount = iCount + 1;
    %>
    If you want to achieve in HTML just have a look @ the following link.
    http://www.hit-counter-download.com/
    Regards,
    Vijay.B

  • Does anyone know how many times a newly purchased product (MB Air 2014) can be exchanged within the 14 day period?

    Does anyone know how many times a newly purchased product (MB Air 2014) can be exchanged within the 14 day period? I feel like the MB Pro would be a better fit for me, so I wanted to exchange my Air for the Pro. But also, if I end up not liking the Pro and want to go back to an Air, would I be permitted to do so with another exchange? (all still within the 14 day window after purchase of course).
    Also, are there any specifics I need to know in order to return my product and get a new one?  Obvioulsy, I would be sure to remove all of my personal files, music, etc...but is there anything else I need to do?
    And lastly, and im sure this question is irritating to you Mac wiz kids out there, but are the two models im comparing really all that different?  I just cant make up my mind and would love some pointers/suggestions/tips/info to help me figure out what model is best for me (the apple employee that was helping me in the store was actually not that helpful at all, if they were I wouldnt have to ask this question on a discussion board).  I do tons of multimedia things and download and enjoy music, tv shows, movies, all that stuff..and I used to love to burn dvds and cds (obviously cant do that with the MB Air now which totally bummed me out ).  Which model does anyone think I should stick with?  Id greatly appreciate some opinions! Really tho, help me out ppls! I'd love some helpful advice! I sometimes have problems making big/important/expensive decisions lol  I just really want to make sure i am getting the best model for all of my daily tasks and all of the things i actually do regularly on my computer.
    Oh, last lastly- I cant afford anything more than a 13" STANDARD MacBook Pro at the moment...soooo the Retina display is unfortunately not an option for me.
    Which is also a big bummer.but i think i can get over it...or beg someone to loan me an extra $200 lol
    Someone....Annnnyyyone....Pleeeeease....Heeelllllllp....
    Thanks

    Just play with each and figure out which one you want. I believe they only allow 1 exchange unless it is a defect issue. You can always return the exchanged item and rebuy what you want if they will not allow you to do multiple exchanges.
    But again, you need to really figure out which one you want.

  • Fire fox is not opening no matter how many times i click on it

    i am using fire fox 30.0 it is not opening not matter how many times i click, it won't show any action i request please solve my problem i have been working on my pc to become perfect and now when it is this is the only problem i am facing now i can't use the best browser in the world

    It is possible that your security software (firewall, anti-virus) blocks or restricts Firefox or the plugin-container process without informing you, possibly after detecting changes (update) to the Firefox program.
    Remove all rules for Firefox and the plugin-container from the permissions list in the firewall and let your firewall ask again for permission to get full, unrestricted, access to internet for Firefox and the plugin-container process and the updater process.
    See:
    *https://support.mozilla.org/kb/Server+not+found
    *https://support.mozilla.org/kb/Firewalls
    *https://support.mozilla.org/kb/fix-problems-connecting-websites-after-updating
    You can use one of these to start Firefox in <u>[[Safe Mode|Safe Mode]]</u>:
    *On Windows, hold down the Shift key while starting Firefox with a double-click on the Firefox desktop shortcut
    *On Mac, hold down the Options key while starting Firefox
    *Help > Restart with Add-ons Disabled
    *https://support.mozilla.org/kb/Safe+Mode
    Create a new profile as a test to check if your current profile is causing the problem.
    See "Creating a profile":
    *https://support.mozilla.org/kb/profile-manager-create-and-remove-firefox-profiles
    *http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Profile_issues
    If the new profile works then you can transfer files from a previously used profile to the new profile, but be cautious not to copy corrupted files to avoid carrying over the problem
    *http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox

  • Opening files doesn't work no matter how many times I press the button.

    Application Basics
    Name: Firefox
    Version: 31.0
    User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0
    Crash Reports for the Last 3 Days
    All Crash Reports
    Extensions
    Name: Adblock Plus
    Version: 2.6.4
    Enabled: true
    ID: {d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}
    Name: Battlefield Play4Free
    Version: 1.0.96.0
    Enabled: true
    ID: [email protected]
    Name: Bitdefender Wallet
    Version: 2.0
    Enabled: true
    ID: [email protected]
    Name: Copy As Plain Text
    Version: 1.0.9
    Enabled: true
    ID: {1a5dabbd-0e74-41da-b532-a364bb552cab}
    Name: DownThemAll!
    Version: 2.0.17
    Enabled: true
    ID: {DDC359D1-844A-42a7-9AA1-88A850A938A8}
    Name: Extended Statusbar
    Version: 1.5.10
    Enabled: true
    ID: {daf44bf7-a45e-4450-979c-91cf07434c3d}
    Name: FastestFox
    Version: 5.2.1
    Enabled: true
    ID: [email protected]
    Name: Freemake Video Downloader Plugin
    Version: 1.0.0
    Enabled: true
    ID: [email protected]
    Name: Freemake Youtube Download Button
    Version: 1.0.0
    Enabled: true
    ID: [email protected]
    Name: Greasemonkey
    Version: 2.1
    Enabled: true
    ID: {e4a8a97b-f2ed-450b-b12d-ee082ba24781}
    Name: InstantFox
    Version: 2.8.9
    Enabled: true
    ID: searchy@searchy
    Name: Multifox
    Version: 2.2.0
    Enabled: true
    ID: multifox@hultmann
    Name: Online Convert
    Version: 1.4
    Enabled: true
    ID: [email protected]
    Name: ProxMate - Proxy on steroids!
    Version: 2.3.3
    Enabled: true
    ID: jid1-QpHD8URtZWJC2A@jetpack
    Name: Show my Password
    Version: 2.0
    Enabled: true
    ID: {cd617372-6743-4ee4-bac4-fbf60f35719e}
    Name: Skype Click to Call
    Version: 7.3.16540.9015
    Enabled: true
    ID: {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}
    Name: Strict Pop-up Blocker
    Version: 0.2
    Enabled: true
    ID: jid1-P34HaABBBpOerQ@jetpack
    Name: Tab Badge
    Version: 1.15
    Enabled: true
    ID: [email protected]
    Name: Text to Voice
    Version: 1.10
    Enabled: true
    ID: [email protected]
    Name: Tile Tabs
    Version: 11.9
    Enabled: true
    ID: tiletabs@DW-dev
    Name: URL Fixer
    Version: 4.1
    Enabled: true
    ID: {0fa2149e-bb2c-4ac2-a8d3-479599819475}
    Name: Video Resumer
    Version: 1.1.3
    Enabled: true
    ID: videoresumer@jetpack
    Name: Yamli for Firefox
    Version: 1.1.0
    Enabled: true
    ID: [email protected]
    Name: Webexp Enhanced
    Version: 1.1
    Enabled: false
    ID: [email protected]
    Graphics
    Adapter Description: Intel(R) HD Graphics 4600
    Adapter Description (GPU #2): NVIDIA GeForce GTX 760M
    Adapter Drivers: igdumdim64 igd10iumd64 igd10iumd64 igdumdim32 igd10iumd32 igd10iumd32
    Adapter Drivers (GPU #2): nvd3dumx,nvwgf2umx,nvwgf2umx nvd3dum,nvwgf2um,nvwgf2um
    Adapter RAM: Unknown
    Adapter RAM (GPU #2): 2048
    Device ID: 0x0416
    Device ID (GPU #2): 0x11e3
    Direct2D Enabled: true
    DirectWrite Enabled: true (6.3.9600.17111)
    Driver Date: 1-22-2014
    Driver Date (GPU #2): 9-1-2013
    Driver Version: 10.18.10.3412
    Driver Version (GPU #2): 9.18.13.2702
    GPU #2 Active: false
    GPU Accelerated Windows: 1/1 Direct3D 10
    Vendor ID: 0x8086
    Vendor ID (GPU #2): 0x10de
    WebGL Renderer: Google Inc. -- ANGLE (Intel(R) HD Graphics 4600 Direct3D9Ex vs_3_0 ps_3_0)
    windowLayerManagerRemote: false
    AzureCanvasBackend: direct2d
    AzureContentBackend: direct2d
    AzureFallbackCanvasBackend: cairo
    AzureSkiaAccelerated: 0
    Important Modified Preferences
    accessibility.newtabplus.homepage: chrome://branding/locale/browserconfig.properties
    accessibility.newtabplus.page: 1
    accessibility.newtabplus.ver: 4.5.2
    accessibility.typeaheadfind.flashBar: 0
    browser.cache.disk.capacity: 358400
    browser.cache.disk.smart_size_cached_value: 358400
    browser.cache.disk.smart_size.first_run: false
    browser.cache.disk.smart_size.use_old_max: false
    browser.cache.frecency_experiment: 1
    browser.places.smartBookmarksVersion: 7
    browser.sessionstore.upgradeBackup.latestBuildID: 20140716183446
    browser.startup.homepage_override.buildID: 20140716183446
    browser.startup.homepage_override.mstone: 31.0
    browser.tabs.warnOnClose: false
    dom.mozApps.used: true
    dom.popup_allowed_events:
    extensions.lastAppVersion: 31.0
    font.internaluseonly.changed: true
    gfx.direct3d.last_used_feature_level_idx: 0
    network.cookie.prefsMigrated: true
    places.database.lastMaintenance: 1406922206
    places.history.expiration.transient_current_max_pages: 104858
    plugin.disable_full_page_plugin_for_types: application/pdf
    plugin.importedState: true
    plugin.state.npuplaypc: 0
    print.printer_Microsoft_XPS_Document_Writer.print_bgcolor: false
    print.printer_Microsoft_XPS_Document_Writer.print_bgimages: false
    print.printer_Microsoft_XPS_Document_Writer.print_colorspace:
    print.printer_Microsoft_XPS_Document_Writer.print_command:
    print.printer_Microsoft_XPS_Document_Writer.print_downloadfonts: false
    print.printer_Microsoft_XPS_Document_Writer.print_duplex: -854238192
    print.printer_Microsoft_XPS_Document_Writer.print_edge_bottom: 0
    print.printer_Microsoft_XPS_Document_Writer.print_edge_left: 0
    print.printer_Microsoft_XPS_Document_Writer.print_edge_right: 0
    print.printer_Microsoft_XPS_Document_Writer.print_edge_top: 0
    print.printer_Microsoft_XPS_Document_Writer.print_evenpages: true
    print.printer_Microsoft_XPS_Document_Writer.print_footercenter:
    print.printer_Microsoft_XPS_Document_Writer.print_footerleft: &PT
    print.printer_Microsoft_XPS_Document_Writer.print_footerright: &D
    print.printer_Microsoft_XPS_Document_Writer.print_headercenter:
    print.printer_Microsoft_XPS_Document_Writer.print_headerleft: &T
    print.printer_Microsoft_XPS_Document_Writer.print_headerright: &U
    print.printer_Microsoft_XPS_Document_Writer.print_in_color: true
    print.printer_Microsoft_XPS_Document_Writer.print_margin_bottom: 0.5
    print.printer_Microsoft_XPS_Document_Writer.print_margin_left: 0.5
    print.printer_Microsoft_XPS_Document_Writer.print_margin_right: 0.5
    print.printer_Microsoft_XPS_Document_Writer.print_margin_top: 0.5
    print.printer_Microsoft_XPS_Document_Writer.print_oddpages: true
    print.printer_Microsoft_XPS_Document_Writer.print_orientation: 0
    print.printer_Microsoft_XPS_Document_Writer.print_page_delay: 50
    print.printer_Microsoft_XPS_Document_Writer.print_paper_data: 1
    print.printer_Microsoft_XPS_Document_Writer.print_paper_height: 11.00
    print.printer_Microsoft_XPS_Document_Writer.print_paper_name:
    print.printer_Microsoft_XPS_Document_Writer.print_paper_size_type: 0
    print.printer_Microsoft_XPS_Document_Writer.print_paper_size_unit: 0
    print.printer_Microsoft_XPS_Document_Writer.print_paper_width: 8.50
    print.printer_Microsoft_XPS_Document_Writer.print_plex_name:
    print.printer_Microsoft_XPS_Document_Writer.print_resolution: 0
    print.printer_Microsoft_XPS_Document_Writer.print_resolution_name:
    print.printer_Microsoft_XPS_Document_Writer.print_reversed: false
    print.printer_Microsoft_XPS_Document_Writer.print_scaling: 1.00
    print.printer_Microsoft_XPS_Document_Writer.print_shrink_to_fit: true
    print.printer_Microsoft_XPS_Document_Writer.print_to_file: false
    print.printer_Microsoft_XPS_Document_Writer.print_unwriteable_margin_bottom: 0
    print.printer_Microsoft_XPS_Document_Writer.print_unwriteable_margin_left: 0
    print.printer_Microsoft_XPS_Document_Writer.print_unwriteable_margin_right: 0
    print.printer_Microsoft_XPS_Document_Writer.print_unwriteable_margin_top: 0
    privacy.sanitize.migrateFx3Prefs: true
    storage.vacuum.last.index: 1
    storage.vacuum.last.places.sqlite: 1406135669
    JavaScript
    Incremental GC: true
    Accessibility
    Activated: false
    Prevent Accessibility: 0
    Library Versions
    NSPR
    Expected minimum version: 4.10.6
    Version in use: 4.10.6
    NSS
    Expected minimum version: 3.16.2 Basic ECC
    Version in use: 3.16.2 Basic ECC
    NSSSMIME
    Expected minimum version: 3.16.2 Basic ECC
    Version in use: 3.16.2 Basic ECC
    NSSSSL
    Expected minimum version: 3.16.2 Basic ECC
    Version in use: 3.16.2 Basic ECC
    NSSUTIL
    Expected minimum version: 3.16.2
    Version in use: 3.16.2
    Experimental Features
    Hi. Whenever I want to upload a picture or a file, no matter how many times I press the "Upload" or "Browse" button, nothing happens. I can keep spam clicking on it and it wouldn't do anything. This is not specific to a site, but happens everywhere. Dragging and dropping files works on Facebook and Imgur, but not all websites support this. I'm using Firefox 31.0 on Windows 8.1. Yes, I have tried restarting Firefox and computer, this has been happening for a while now. Thanks.

    Boot the computer in Windows Safe Mode with network support (press F8 on the boot screen) as a test.
    *http://www.bleepingcomputer.com/tutorials/how-to-start-windows-in-safe-mode/
    This probably still applies to Windows 8:
    Try to delete the MRU (Most Recently Used) ComDlg32 registry keys with the registry editor (regedit.exe).
    Navigate to: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32
    Delete the subkeys (LastVisitedPidlMRU and OpenSavePidlMRU)
    Be cautious with editing the registry as there is no Undo possible: all changes are applied immediately.
    You can export registry keys before making changes.
    * http://www.winhelponline.com/articles/195/1/How-to-clear-the-file-names-MRU-in-Common-Dialog-boxes-in-Windows-Vista.html

  • How many time do I need to update to Canon printer drivers 2.6?

    I keep hoping the next update will fix it, but no... Canon Printer Software Update 2.6 keeps showing up and no matter how many times I install it, it doesn't go away.  I've tried deleting the drivers and the receipts, etc.  to no avail.  Any suggestions?

    I'm having the same problem on Lion 10.7.1 and 10.7.2

  • Fitbit does not sync with healthvault no matter how many times I add and delete it

    My healthvault never shows any information synced from fitbit.com, I have the scales and a tracker and no matter how many times I add and delete it through the fitbit share healthvault page but  it never ever syncs over night. I have left is weeks and
    still nothing in HV.
    I am starting to wonder if HV supports fitbit? Any help would really be appreciated, this is driving me insane.
    Do I need to create a new account? is my account just broken?

    Hi,
    I have spoken with FitBit about this issue and they provided the following:
    Since you have already linked and unlinked your account and still having issues please contact Fitbit Support (http://help.fitbit.com/?cu=1)
    for further assistance."
    Addititionally when you contact FitBit can you please let them know that you have already contacted HealthVault.
    Thanks
    Tomas
    MS HealthVault Support

Maybe you are looking for

  • How to reconcile Reconciliation account with Vendor master (Very urgent)

    Hi, My reconciliation account balance is not tallying with accounts payables. There are 250 vendors are there. Is there any programme to check this, or we have do manually?? Early action would be highly appreciable and points will be added for the be

  • Problem in XML generation

    Hi All, I am new to SNC consulting, currently i am learning the Purchase order Process of SNC. I created plant, material, Vendor and info records in ECC 6 and ciffed these data to SNC 7.0 system. After this i created a normal PO in ECC and an IDOC of

  • Graphics scaling issues in Flash Builder 4.5.1

    Please review this screen shot. Details follow the image. FB 4.5.1 applicationDPI = "160" Graphics using MultiDPIBitmapSource scale fairly well. Graphics used for these properties do not scale well at all: 1) ViewMenuItem's "icon" property. 2) List i

  • Issue when the GlobalTransactionsProtocol is set as OnePhaseCommit

    Hi, For the Data Source, the GlobalTransactionsProtocol is set as OnePhaseCommit For certain transaction, I get this error. JDBC driver does not support XA, hence cannot be a participant in two-phase commit. To force this participation, set the Globa

  • Windows java server node best practice?

    I'm coming from the windows/.NET world where I would usually expect a service that can be managed from the services applet or via the usual command line remote admin utils and doesn't need to interact with the console. Starting a java instance in a c