Using the StringTokenizer But Have a Delimiter of "char" type

I am using the java.util.StringTokenizer to break a String into tokens.
The delimiter is common (i.e. ',') and I declare it as a char.
I have a compilation error becasue the StringTokenizer requires the delimiter of the String type. How do I handle the problem?
                        char delimiter =  ',';
                        int longest = 0;
                              StringTokenizer t = new StringTokenizer( letters, delimiter );
                              while ( t.hasMoreTokens() )
                                   String token = t.nextToken();
                                   int length = token.length();
                                   if ( length > longest )
                                        longest = length;
                              }

How do I convert a char to a String?Familiarize yourself with the API for Character and String, I can see about 4 different ways of doing this.
Or do it the shortcut way ;-)char c = 'c';
String s = "" + c;db
edit Now why wasn't #3 on the page before I posted? Forum lagging again?
@OP: The other ways are
-- put the char in a one-element array and use the appropriate String constructor, or static method copyValueOf
-- static method String#valueOf(...)
Edited by: Darryl.Burke

Similar Messages

  • Now i cannot see my bookmarks toolbar icons in firefox 4, i could before but now the images have dissapeared, i can still use the bookmarks, but have to wait for the box to come up explaining wich link it is to know what im choosing

    i had my bookmarks tab set up to show no names of bookmarks just the icons, the button is still there but i cant see any icon, the link works fine, the only issue here is the icon does not show so i cannot decipher between the links unless i hover over each button and wait for the message details

    Did you edit the names to clear them or did you use other means like an extension or code in [http://kb.mozillazine.org/UserChrome.css userChrome.css] ?
    Many extensions haven't been updated yet to work properly in Firefox 4.0
    * CheckPlaces: https://addons.mozilla.org/firefox/addon/10897
    * Favicon Picker 2: https://addons.mozilla.org/firefox/addon/3176

  • I purchased a magazine using the Zinio app which I'd recently downloaded on to a recently purchased iPad. I received an error message at the time (can't recall the details) but have since been invoiced for the $8.99. How can I get the Magazine I purchased

    I purchased a magazine using the Zinio app which I'd recently downloaded on to a recently purchased iPad. I received an error message at the time (can't recall the details) but have since been invoiced for the $8.99. How can I get the Magazine I purchased?

    FOR ASSISTANCE WITH ORDERS - iTUNES STORE CUSTOMER SERVICE
    For assistance with billing questions or other order inquiries, please refer to our online support page by clicking here: http://www.apple.com/support/itunes/store/. If you cannot find the answers you are seeking in our robust knowledge base, you can contact us by visiting the following URL http://www.apple.com/support/itunes/store/, clicking on the appropriate Customer Service topic, then using the contact button or email form at the bottom of the page. Responses to emails will be provided as soon as possible.
    Phone: 800-275-2273 How to reach a live person: Press 0 four times
    Hours of Operation: Mon-Fri: 9am-5pm ET
    Email: [email protected]
    How to report an issue with Your iTunes Store purchase
    http://support.apple.com/kb/HT1933
    How to Get a Refund from the App Store
    http://gizmodo.com/5886683/how-to-get-a-refund-from-the-app-store
    Canceling a Digital Subscription
    http://gadgetwise.blogs.nytimes.com/2011/10/14/qa-canceling-a-digital-subscripti on/
     Cheers, Tom

  • My iphone 5 went into search mode and I can't place or receive calls or use the internet but my text messages work. Sprint had me do a master reset and my phone doesn't work at all now I can't get it past the activation. Will I have to pay in store?

    My iphone 5 went into search mode and I can't place or receive calls or use the internet but my text messages work. Sprint had me do a master reset and my phone doesn't work at all now I can't get it past the activation. Will I have to pay for repairs in store because I didnt get the Apple care plan when I purchased it. Sprint said it may be a phone problem not sure if I should take it to Sprint or Apple...I just need my phone

    I'm sorry to learn that you are not able to make/receive calls chelseabee! (ticket number removed) results indicate that there is no issues with the network or account provisioning. Since you have already done a hard reset http://vz.to/1gBkSJc (as per your post), I recommend exploring replacement options. If your phone is within the one year manufacturers' warranty we can provide a Certified Like New replacement http://vz.to/uyYF0o as long as no physical/liquid damage exist. If your phone has sustained physical/water damage and you have insurance, you can submit a claim to the insurance company online at this link http://bit.ly/07CrqPK
    AntonioC_VZW Follow us on Twitter at www.twitter.com/VZWSupport
    >> Edited to comply with the Verizon Wireless Terms of Service <<
    Edited by:  Verizon Moderator

  • I am unable to see the airplay icon on my macbook air, iphone or iPad which would enable me to use my Bose speaker through airplay. I set this up in the UK but have taken my macbook and bose speaker travelling with through Thailand. Ive wifi in my room an

    I am unable to see the airplay icon on my macbook air, iphone or iPad which would enable me to use my Bose speaker through airplay. I set this up in the UK but have taken my macbook and bose speaker travelling with through Thailand. Ive wifi in my room and am able to access the internet on my laptop, Ive also been able to through the Bose Soundlink air wifi set application connect the bose speaker to the Wifi too.
    I am only able to play my itunes through my macbook speakers and cannot find the airplay button which should be next to the volume slide once turned down to less than 1/3 of the volume..

    Thanks for your help.  Since I'm uninterested in loading all my photos (the only option) into photostream, I won't be able to use the settings in ATV.  I guess I'm just stuck with using iPhoto on my MB Air.  Thanks again.
    paul

  • I have Pages 09 and I have  created a business card using the template but can't figure out how to duplicate it to the other 9 on the page Am and sure I am going to look daft coz its only the click of a button but I can't work it out Thanks

    I have Pages 09 and I have  created a business card using the template but can't figure out how to duplicate it to the other 9 spaces on the page. I am and sure I am going to look daft coz its only the click of a button but I can't work it out Thanks

    I do the following: Hold down the command key and highlight all the items to be reproduced. Then hold down option and drag the items from the first to each subsequent card.

  • I have a VGA adapter and an iPad2.  Tried projecting my iPad2 to projector using the VGA but doesn't work.  Tried it with friend's iPad1 and it works.  Why??

    I have a VGA adapter and an iPad2.  Tried projecting my iPad2 to projector using the VGA but doesn't work.  Tried it with friend's iPad1 and it works.  Why??  Pls help.

    Yup - nothing happens.  I then took the same VGA cable and plugged it into my friend's iPad1 and it worked perfectly when she opened Keynote.  My understanding is that the iPad2 mirrors the entire screen, so no need to go into any specific application in order to project to the screen, right?  Do I need to download any specific app or change any settings in order to be able to project the screen using VGA?
    Sorry - novice at this.  Not very tech minded either...

  • I have OS X, vers. 10.6.8.  I want to use the icloud, but I don't want to get Mountain Lion.  Can Ido this?

    I have OSX, vers. 10.5.8.  I want to use the Cloud, but I don't want Mountain Lion.  Can I do that?

    You cannot access iCloud with 10.6.8. If your computer supports it you could upgrade to Lion - you can obtain it by ringing the online Store at the number given at bottom left of this page. The requirements for Lion are:
    Mac computer with an Intel Core 2 Duo, Core i3, Core i5, Core i7, or Xeon processor
    2GB of memory
    OS X v10.6.6 or later (v10.6.8 recommended)
    7GB of available space
    If you don't want Mountain Lion you probably won't want Lion either (of the two Mountain Lion is probably preferable) but it's either that, or stick with 10.6.8 and no iCloud.

  • I was wondering if there's a way to connect to my work server from my home iMac i7. I can't seem to get Share Screen to work. I have tried connecting to server using the vnc but doesn't work.

    I was wondering if there's a way to connect to my work server from my home iMac i7. I can't seem to get Share Screen to work. I have tried connecting to server using the vnc but doesn't work.

    The easiest way would be to use Back to My Mac, but that will only work if the server is a Mac running OS X 10.7 or later and you have the cooperation of the network administrator.
    OS X: Using and troubleshooting Back to My Mac with your iCloud account

  • My iMac 27" screen is black and will not start. The computer is making noise and beeps when i use the keyboard but I can't see anything. I have rebooted with no success

    My iMac 27" screen is black and will not start. The computer is making noise and beeps when i use the keyboard but I can't see anything. I have rebooted with no success

    Have a look at these. And please say what OS you have.
    http://support.apple.com/kb/ts1411
    http://support.apple.com/kb/ts1367

  • I have used Pages 09 and Keynote without any major problems until this new update. I have read many of the fixes but have a problem. When you get Pages 09 and Keynote back, Apples continues to want to update the 09 system. So it stays updated.

    I have used Pages 09 and Keynote without any major problems until this new update. I have read many of the fixes but have a problem. When you get Pages 09 and Keynote back, Apples continues to want to update the 09 system. So it stays updated. I have had to turn off my auto updating that was nice but I'll do it one at a time in order to keep the Pages 09 and Keynote. When something works don't mess with it. Any fixes out there?

    I can't say that I have had a problem playing videos in Flash because I could always play them in browsers other than Firefox.
    In Firefox Tools>options>Advanced Hardware acceleration is turned on.
    I don't know if that is different that tuning it off and on in Flash or not, but for now it is a moot point.
    As I stated in my previous message, after following all earlier suggestions/instructions nothing helped. But The latest one, someone suggested that maybe version 17 of Flash might be a stable version.
    I made no other changes except to install it, a few days ago, and so far so good.
    Many thanks for your help,
    Giovanni

  • HT5622 Can I have two apple id's on the same iPad. Example me and my spouse want to share the iPad but have different id's

    Can I have two apple id's on the same iPad. Example me and my spouse want to share the iPad but have different id's

    iOS does not support multiple users like a desktop OS does.
    You can use a web interface to your respective email accounts
    to keep things separate; but there is no provision for otherwise
    separating photos, media, etc.
    If you wish, you can contact Apple to let them know of your desire:
         www.apple.com/feedback

  • We bought an iphone 4s for our daughter. We transfered it to straight talk. She can make calls and text no problem. She can use the WiFi but is unable to use the internet or mms. How do we update the APN?

    We bought an iphone 4s for our daughter. We transfered it to straight talk. She can make calls and text no problem. She can use the WiFi but is unable to use the internet or mms. How do we update the APN?

    To clarify for anyone who is still having any problems doing this.
    1. Unlock your phone with the carrier ( I know the process will work if it is jail broken but I am assuming you dont want to void the warranty on your phone) NOTE: even if you purchased the phone outright at Wal-Mart it is still locked to ATT so you will have to unlock the phone.  If it's already unlocked skip to step 2.  This works and will work even if you update the phone. 
    1a Here is the link to unlock a ATT iphone. Simply follow the instructions https://www.att.com/deviceunlock/client/en_US/
    2. Get a T- mobile SIM. Even if you don't want the service, if you feign interest, they will send you one for free or 99cents. If you need it now you can get one at a T-mobile store too.
    3. Once you have both your Straight talk SIM and your T-mobile SIM follow these instructions:http://www.youtube.com/watch?v=mFFf5uqk18M
    4. If you have any remaining questions look at all the responses posted previously on this thread or check out the Howard Forums Wiki: http://wiki.howardforums.com/index.php/Straight_Talk_iPhone
    Everything should work flawlessly at this point.  If not let me know and I'm happy to help when I can.  I hope this makes doing this very easy for everyone in the future. God Bless -J

  • Using the StringTokenizer

    Hi all,
    I'ld like to use the StringTokenizer to solve the following situatio:
    I have a dynamic String as: |type_1:value-1|,...,|type_1:value-n|,|type_2:value-1|,...,|type_2:value-n|,...,|type_n:value-1|,...|type_n:value-n|.
    So My idea is to get for each type, all his values and puting them into an array and when I want to get (for example) the values associated to the type_1 I may have: (value-1,value-2,...,value-n) and so on. Can some help me to do this class?
    Pit

    Well, the basic problem of getting the needed values per type can be done by:
    public class A{
    public static Vector getList (String string,String type){
         Vector v = new Vector();
         StringTokenizer st = new StringTokenizer (string,"|" );
         type = type+":";
         String tmp = null;
         while(st.hasMoreTokens()){
              tmp = st.nextToken();
         if (tmp.startsWith(type)){
         v.add(tmp.substring(type.length())
         return v;
    }

  • Photoshop elements quit working, I uninstalled it, tried to re-install using the cd, but getting errorPhotoshop elements quit working, I uninstalled it, tried to re-install using the cd, but getting error, any other way to re-install it without the disk ?

    Photoshop elements quit working, I uninstalled it, tried to re-install using the cd, but getting error, any other way to re-install it without the disk ?

    Yes.
    Download Photoshop Elements products | 13, 12, 11, 10
    However, the real issue is why the program is not working. Did you install anything recently?
    When you tried to re-install from the disk, did you shut off the antivirus program temporarily?
    Have you tried a system restore to a point in time when the program was working properly?

Maybe you are looking for

  • Error about mapping with sqlexec when delete data

    I've created a sample replication process There's no problem when i'm inserting data (lookup process is working well too) but when i'm deleting data from source table it cannot delete record in target table and this is the error ERROR OGG-01296 Oracl

  • Iphone not recognized on macbook pro (10.6.7)

    Its not getting recognized bij the latest itunes. Other iphones do get regonized the usb ports are ok. The cable is ok. I can charge it with a regular charger. Tried: Reinstalling Itunes DFU mode recovery mode update macbook restart macbook tried it

  • This content requires the Adobe Flash Player

    Hi I have flash installed in the firefox browser and both versions are up to date. For some of the players on browser it says "This content requires the Adobe Flash Player" but for some others it works fine like for Youtube. Can anyone let me know wh

  • Mac gets heated up quickly

    I am using my macbook pro from past 4 months and I have nticed that it gets heated up very quikly...again when I put it on charge I get static charge when I touch my mac...can some1 pls explain this??

  • Why wont my purchased TV Shows not sync?

    Hi there, i have set up my Apple TV to sync all my unseen TV Shows and some music and some photos. After syncing actually it has synced some old videos which i have manually put into iTunes, but it will not sync my purchased "daily show" episodes, th