Another question about string!

Hi,
I want to return a function as true if all the characters in that string are hexDigit. false otherwise.
& also another class should return as true if all the charaters are Digit. false otherwise i was using
public boolean isDigit(String str)
for (int i=0; I<str.length(); i++)
if (str.charAt(i).isDigit)
return true
return false
what's wrong with this code? what shall I use instead of this? can anyone Help please?

The way you've written it, you'll be returning true as soon as the first digit in the string is found:
// on first loop will check first char in string.
if(str.charAt(i)isDigit)
// first char in string is a digit so method returns true
return true;
[\code]
You could change it so that you will return false when non-numerical character is found. If none is found you will fall out the loop and return true.if(!str.charAt(i).isDigit)
return false;
return true;
[\code]
Don't know if there's a method for checking hexDigit. If not use something like:
if (str.charAt(x).isDigit || str.charAt(x) >='A' && str.charAt(x) <='F');
[\code]

Similar Messages

  • ANOTHER Question about my iMac G3. Mac OS X and RAM

    Hey, I have ANOTHER question about my iMac G3.
    I know that I'm supposed to have the latest firmware updates for my iMac G3 running OS 8.1, which I do, but I read some where these firmware updates could only be updated if you're running OS 9.2. Yet when I run the firmware updater, it says my firmware is up to date. I just wanted to make sure this was correct because I just ordered an OS X 10.2 CD today, and I don't want my mac to be "dead" when I install it.
    My next question is how much RAM can my mac hold. It's an iMac G3 with a 233 mhz processor, if that makes a differemce.
    Again, thanks to the people who have helped me with my first Mac.

    hi there--
    unfortunately you require system 9.1 or 9.2 for the required firmware update 1.2 for your computer http://docs.info.apple.com/article.html?artnum=86117. so you'll have to install that if you want to install 10.2. it may work for you for a little while, but then you could possibly lose all your information. so i wouldn't advise attempting installing 10.2 without the correct firmware. [ : ) ]

  • Yet another question about super raid - GS70

    Yes, another question about Super Raid...I recently picked up the cheapest model of the GS70 on newegg which comes with 1 mSata SSD...just a mediocre one if I remember reading correctly.  I'm interested in using MSI's Super Raid once my warranty is over with and have been reading a couple posts here:
    1. Walk through of how to reinstall OS
    --> https://forum-en.msi.com/index.php?topic=167198.msg1224063#msg1224063
    2. I'll need a Super Raid card with links to get some, for about $100 each
    --> https://forum-en.msi.com/index.php?topic=171722.msg1252847#msg1252847
    3. I can't get Super Raid unless it originally came with it?
    --> https://forum-en.msi.com/index.php?topic=171185.msg1249640#msg1249640
    So what's the bottom line? Would I still be able to enable super raid in the future or am I SOL since it didn't come with it originally?
    thanks!

    The GT70 CAN come with an adapter that has 2 (on the older, GT70 0NX models) or 3 (on newer GT70 20X models) sockets for mSATA drives. It's an optional part, that takes place of the primary SATA drive in the notebook, and physically has a different part that connects to the motherboard. If it doesn't come with the SuperRaid adapter, then it just has support for a single 2.5" SATA drive.
    The GS70 on the otherhand, has this built into the motherboard and there is no swapping it out for a normal 2.5" SATA drive. You can only use mSATA drives (on those ports). The GS70 is meant to be an ultrabook, and therefore does not have the same ability as the GT70 to house up to 2 full size 2.5" SATA drives.
    That's really the main difference here. Without physically seeing a GT70 to see how the SuperRaid adapter works, it's slightly difficult to explain.
    But in the end, I wouldn't worry about the SuperRaid....The GS70 should have support for Intel Raid Management Engine, in which case that's all you really need.

  • Another question about gmail

    I just posted a question about adding gmail and it was answered.  Now, I have another question,  I added the new gmail account.  It shows in the mail preferences under accounts.  Incoming mail addressed to gmail comes to the Archive Box. But I still can't send mail by gmail because in the drop down menu on the email it only lists my other two accounts.  Gmail is not an option.  I highlighted gmail in the account list and it showed that as the account in use.  But, still there was no gmail option on the email form in the sender box.  How do I fix that?

    You need to look at and read over these very carefully.
    http://support.apple.com/kb/TS3276
    The link above is about sending issues.  The one below is about setting up or confiquring new e-mail.
    http://support.apple.com/kb/HT1277
    Good Luck to you and welcome to the Discussions.
    Don

  • Another question about adding music to iPhone

    Apologies for yet another question regarding adding music to an iPhone but I am completely stuck.
    I bought a new laptop in January (it runs windows 8). I've authorised it and synced my phone to it before. I've used it to add music before.
    Lately I've just been buying music directly from itunes on my phone but I wanted to add some music from my older collection that is on an external harddrive.
    I've gone through the process of syncing the phone again, which has wiped whatever was on there. I made sure I'd ticked on the "manually manage music" box. 
    It's put all my purchased music back but it still will not let me drag and drop music from my external harddrive. When I hover over with the file it has "link" but it won't actually send the music to the phone.
    Is there a way for me to do this without putting music on to my itunes library? I don't like itunes and I definitely don't want to add the music to my laptop as it defeats the purpose of having an external harddrive! Sorry for such a long-winded explanation.

    Just to add... I've now tried adding music to the library (getting desperate here) and it's not letting me do that either. Just says 'link'.
    This is the most frustrating thing ever. Why are the simplest of tasks made so difficult? It seems like it only works if you buy the music from the iTunes store.

  • Yet another question about burners for iDVD 6

    It's not my intention to be redundant and the question about which DVD burners are compatible with the most recent release of iDVD has been asked a few times since iLife '06 was released at MacWorld last week. Yet, though Apple has announced it, why have they not posted a list of compatible devices?
    Or, is the onus on the manufacturers to certify that their burners are compatible with iDVD 6?
    In either case, has anyone determined if this information is available and, if so, where?
    Thanks.

    Or, is the onus on the manufacturers to certify that their burners are compatible with iDVD 6?
    Check with the support sections of the manufacturer's websites - after all, THEY are the ones trying to sell burners.

  • Another question about a VI I obtained from a NI forum.

    The append_column VI attached below has two FOR LOOPs. When this VI is executed The first FOR LOOP executes 10 times as indicated by the CONSTANT 10 wired to the [COUNT] or [N]. My question falls after the first FOR LOOP is complete. How is the second FOR LOOP activated. I thought the [N] had to be wired for the FOR LOOP to execute? In this VI the second FOR LOOP doesn't have the [N] wired to anything so how does it know to execute 10 times which it does?
    Attachments:
    append_column.vi ‏47 KB

    Hi
    Actually there is a another way to set the number of times a FOR loop should run, which is illustrated by the VI in question.
    Any array input to the FOR loop may used to set the number of times to run. Look at the string array input of the VI, inside the FOR loop the array is not an array anymore, but rather simple strings, this input is set to "Enable indexing". Inside the loop the individual elements of the array is automatically extracted from the array one at a time. I.e the first run of the loop extracts the first element of the array, the second run of the loop gets the second element of the array. The FOR loop will run until all the elemnts of the array has been "read".
    You win twice with this design, first, You don't have to know how many times to
    run the loop, it will always run as many times as there are elements in the array. Second, You don't have to index the array inside the loop with array indexing tools, it is automatically done by the FOR loop.
    You enable / disable this feature by right-clicking the array connection on the loop and selsecting enable/disable array.
    tomcat

  • Another question about generics

    Consider the following hierarchy of classes:
    class Fruit {...}
    class Orange extends Fruit {...}
    class Apple extends Fruit{...}
    Now I need to declare a collection wherein I could store any type of Fruit (including its derivated classes), but also gather some fruits.
    I hare read that for reading I need to declare the collection as follows:
    Set<? extends Fruit> fruitSet = new HashSet<Fruit>();
    and for writing I need the following declaration:
    Set<? super Fruit> fruitSet = new HashSet<Fruit>();
    My question is, is there an efficient way to declare the collection so that both operations be feasible in the class? In the current version, I use generic method and need to re-cast for some calls.
    Can anyone help?

    What they're talking about is the fact that parameterized types are not covariant. You can't treat a List<Rectangle> as a List<Shape> because they are not the same thing. Arrays on the other are covariant, you can treat a Rectangle[] as a Shape[].
    No, with your example it will not generate a compile time error, but I do see what you're getting at.
    public void readFruit(Set<Fruit> fSet) {
        // snip
    Set<Apple> fruits = new HashSet<Apple>();
    readFruit(fruits); // error because Set<Apple> is NOT a Set<Fruit>It has nothing to do with whether or not fruits contains Apples and Oranges, it's how fruits is declared. While a Set<Fruit> may contain Apples and Oranges a Set<Orange> is not a Set<Fruit>. So if you attempt to pass a Set<Orange> to a method that takes a Set<Fruit> you might as well be trying to pass an int to a method that accepts a String, they're not the same, there is no is-a relationship. So this is what you do:
    public void readFruits(Set<? extends Fruit> fSet) {
        // snip
    // All work because it will take any Set<E> where E extends Fruit.
    readFruits(new HashSet<Fruit>());
    readFruits(new HashSet<Apple>());
    readFruits(new HashSet<Orange>());What this says is that fSet can be any Set<E> where E is a subtype of Fruit. It doesn't matter what implementations the Set actually contains. If it's a Set<Fruit> and it contains Apples, it doesn't matter, it's simply allowing you to pass a Set<Apple> or Set<Orange> as opposed to only being able to pass a Set<Fruit>.

  • Another question about custom JComponents and JPanels

    Okay, so new issue now. I will be researching this as best I can while I wait for a reply.
    So I made a custom Component, and added it to a custom Panel. The Panel only contains this Component.
    If in the JFrame I create a JScrollPane and add the custom panel to it, then the scrollbar works exactly right. But, if I add the custom panel to another panel, it doesn't work. It just puts a one pixel border around the panel and centers it. I'm gonna go and read all about ScrollPanes and what it uses as a basis.
    Any help will be greatly appreciated.

    import java.awt.*;
    import javax.swing.*;
    public class WDF extends JFrame
        WDF()
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            setSize(500, 300);
            WaveFormPanel test = new WaveFormPanel(500, 100);
            add(test);
            setLocationRelativeTo(null);
            setVisible(true);
        public static void main(String[] args) {
            new WDF();
    class WaveFormPanel extends JPanel
        LineComponent myLine;
        public WaveFormPanel(int width, int height)
            // to ... have the scrollpane constrained
            // to be a certain size, i.e., 400 by 100
            // no matter how large the LineComponent is.
            // You can use GridBagLayout to have scrollPane
            // shown centered and at its preferredSize.
            // The default FlowLayout will also show the
            // scrollPane at its preferredSize.
            setLayout(new GridBagLayout());
            GridBagConstraints gbc = new GridBagConstraints();
            myLine = new LineComponent(width, height);
            JScrollPane sPane = new JScrollPane(myLine);
            sPane.setPreferredSize(new Dimension(400, 100));
            add(sPane, gbc);
    class LineComponent extends JComponent
        int lineWidth;
        int lineHeight;
        public LineComponent(int width, int height)
            lineWidth = width;
            lineHeight = height;
            this.setPreferredSize(new Dimension(width, height));  
        @Override
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            g.drawLine(0, 0, lineWidth, lineHeight);
    }

  • Another question about upgrading RAM on G4 iMac

    I know that there are numerous threads on this forum about upgrading RAM and I am sorry to have to open another one but, having read many of them, I am still confused!
    I have unopened copies of Leopard and ILife 08 that I am planning to install on my 17-inch 1GHz G4 iMac with 768 MB of RAM (256 MB in the factory slot and 512 MB in the user accessible slot). I know that this model does not support all the functions of these programs but I am currently running Panther and the very first iLife so I think it's time for an upgrade!
    Apple states that this model supports up to 1GB RAM so I have been thinking that in order to get the best out of the new software I should upgrade to 1GB RAM. My questions are:
    1. Do I need to upgrade or is the existing RAM of 768 MB likely to be sufficient?
    2. If I upgrade, how easy is it to add RAM to the factory slot? I have searched but can find no instructions on this here or on the Apple website which implies that this is not recommended.
    3. Several threads on this forum seem to suggest that, in order to avoid having to mess with the factory slot, it is possible to put 1GB RAM in the user accessible slot and leave the factory slot well alone, resulting in total RAM greater than the maximum recommended by Apple. Is this correct or have I misunderstood?
    Thanks in advance.

    1. Do I need to upgrade or is the existing RAM of 768 MB likely to be sufficient?
    That will probably be sufficient. You could always install and run both Leopard and iLife '08 and see if you feel that they are working OK before buying any RAM.
    2. If I upgrade, how easy is it to add RAM to the factory slot? I have searched but can find no instructions on this here or on the Apple website which implies that this is not recommended.
    Apple does not post the directions because this is not considered something that a user can do by themselves.
    You can see the process at www.xlr8yourmac.com/systems/iMacg4/imacg4takeapart.html
    3. Several threads on this forum seem to suggest that, in order to avoid having to mess with the factory slot, it is possible to put 1GB RAM in the user accessible slot and leave the factory slot well alone, resulting in total RAM greater than the maximum recommended by Apple. Is this correct or have I misunderstood?
    That is correct. You could replace the 512 MB in the user accessible slot with 1 GB to provide a total RAM of 1.256 GB.

  • Another question about multiple copies

    I've seen several others posting questions lately about making multiple copies, but my question is just slightly different. I'll be making an iDVD project for our 5th Grade Recognition at school. Obviously, I'll be making it on my Mac at home. However, once it's finished and I have my final DVD, I'm going to need to make over 50 copies.
    Last year, when I did the presentation as a Powerpoint show, it was easy enough to use multiple (Windows) computers at school to duplicate. There are 4 computers that I used to just rotate CD's in and out of to make copies.
    Will I be able to use a Windows machine to make copies of an iDVD disk? I know that the computers can burn DVD's, so that's not an issue. I can't remember exactly which programs the computer have. I believe that one is Sonic something. The one that I used for CD's was IRecordNow (or something like that).
    Is there any "protection" placed on the iDVD disk that will prevent me from placing the iDVD into the drive and choosing "copy" in whatever program that I use?

    Is there any "protection" placed on the iDVD disk that will prevent me from placing the iDVD into the drive and choosing "copy" in whatever program that I use?
    No. Only DVDs made in a production house have copy protection applied.
    (31727)

  • Another question about smart playlists

    Hi,
    I have been experimenting a lot with smart playlists lately and have 3 now that I have set up with help from this forum so far. However, I have a question I don't see an obvious answer to. That is, I have every song in at least one playlist, and some songs are in multiple playlists. I can add a playlist to a rule, but how can I tell ITunes to create a playlist containing songs that are in more than one playlist? For example, I want ITunes to create a playlist from songs that are in more than one of the following playlists, top 25 most played, purchased, and tagged. How can I set up ITunes to do this?

    The checkmark on the right side when you're editing smart playlists adds more rules. Make as many rules as there are playlist that you're looking into and make each rule say "playlist _is_ (fill in the playlist from the dropdown." If you want songs that appear in ALL the selected playlists you select match ALL of the rules at the top. If you want songs that appear in any of the playlists you've selected you have to select match ANY rule at the top. If you have three playlists and you're looking for any songs that appear on any two of the playlists, but they don't necessarily have to appear on all three, then unfortunately there's no way to do that with one smart playlist. You'd have to make a smart playlist with one saying playlist top 25 most played+purchased (match ALL) another saying with playlist top 25 most played+tagged (match ALL), another saying playlists purchased+tagged(match ALL). Then you could make a 4th smart playlists saying to add the other three playlists and you'd end up with one playlist that has only songs that appear in ANY of the other three.
    Note: there's an option that appears to make subrules as if you could do the above all in one playlist but unfortunately these don't actually work the way they appear they should in my experience.

  • Question about string manipulation

    Hello, I am practicing with Java and trying to learn it, and have a quick question. I am trying to get the count on a string of numbers for after a decimal point. the numbers are generated as the result of a math, so I can't use index, since the location of the decimal changes based on the number imputed. I want to figure this out on my own, but have hit a wall here, i've spent the past few hours trying every string command I can think of, and haven't figured it out yet, anyone mind pointing me in the right direction for which string to use? Thanks in advance for any help you can provide!

    Is this what you want?
    public class Fallen{
      public static void main(String[] args){
        String number = "123.45678";
        String frac = number.substring(number.indexOf('.') + 1);
        System.out.println(frac + " length=" + frac.length());
        frac = number.replaceFirst("^.+\\.", "");
        System.out.println(frac + " length=" + frac.length());
    }

  • Another question about listbox

    I designed a process in workbench which gets all information about customer and  fills in rows which is under the table but I want to list them as a list in listbox or row by row it doesnt matter . The problem is I have no idea to do ? can you give some clue or hint or example?
    thank you very much   

    Blue folders are mailboxes. For each blue folder in Mail there is a corresponding folder in the filesystem within HOME/Library/Mail. Its name has an .mbox suffix if mail is stored locally and .imapmbox if mail stored remotely on the server.
    White folders are meant to organize mail hierarchically and cannot contain messages of their own, only subfolders or mailboxes. For each white folder in Mail there is a corresponding folder in the filesystem within HOME/Library/Mail. Its name has no suffix.
    That's the easy part. Things are way more intricate than that, however. For one thing, blue folders are also allowed to contain other subfolders (either blue or white) in addition to messages of themselves. When this happens, there is a folder with .mbox/.imapmbox suffix and another without, and both are associated with the same blue folder in Mail. Also, under some circumstances, Mail does let you drop messages on white folders, but it cannot handle the situation properly thereafter -- see Mail loses messages moved into IMAP folders.

  • Another question about iPhones and malware/virus

    Thought I would post this as a separate question.
    iPhone 4s. legit (not jail broke)
    I know the iOS is pretty protected against virus and malware.  And that you cannot download things onto the phone other than through the app store
    But what about what they call drive by downloads? Where you go to a web page and it automatically installs something without asking?

    UACount wrote:
    thanks all. This is so freaky to me. If the iOS is so safe, why doesnt every PC use it?  And I dont mean that sarcastically
    It's very safe but it also puts very severe limits on what the user can do to tweak the OS and on things that applications can do. For example, most people would balk at only being able to by applications for their computer from one approved source. In fact, a lot of people don't like that about iPhones. Some people prefer freedom to modify their device to security.
    In fact, the Mac OS, which historically been less prone to viruses is adopting some of the feature of iOS.

Maybe you are looking for

  • SAPSQL_ARRAY_INSERT_DUPREC - ABAP runtime error

    Dear Experts, I am getting a abap dump. Runtime Errors         SAPSQL_ARRAY_INSERT_DUPREC Exception              CX_SY_OPEN_SQL_DB Error analysis | An exception occurred that is explained in detail below. The exception, which is assigned to class 'CX

  • Would my music in the iPod got deleted in this situation?

    I have my iPod automatically updated with iTunes. But now my computer has the window reinstalled, all my music in the computer hard disk is gone and so as the iTunes program. The iTunes that I install now of course has no song library or any song in

  • How do I change the start up screen statement?

    How do I change the phrase for the start up (sign in) screen? I put one there on a previous system and it carried over, so I know its in my user files somewhere?

  • Graphics linked from FM reference pages don't display

    Before I tell my department that they must edit each of the hundreds of caution and warning notes in thousands of pages: Is it true to say that graphics linked from reference page in FM do not appear in help files? This is a commonly use style: Parag

  • Lombard won't recognize new battery

    After years of inactivity I wanted to give my old Lombard G3 to my little child so I bought new battery and new AC charger. Now the problem is that Lombard won't recognize the new battery at all. Red cross on battery icon on top and empty slot in str