Please Help: Ignore first Character in a String.

How do you ignore the first Character in a String?
String a = JTable.getValueAt(row,column).toString();
//Ignore first Char of a? ('$')
double b = Double.valueOf(a).doubleValue();Any help would be appreciated!

Ok,so I do that. Now I have the Char '$'. But I don't want '$', I want everything after it. Must I loop throught the rest of the string or can I just remove the first Char?

Similar Messages

  • The first character in a string

    I need to return the first character of a string, convert it to an integer, and compare it with another integer to see if they're the same. Sounds simple, even for me, but it won't work!!!
    // First question >
    Object userValue1 = JOptionPane.showInputDialog("Blah Blah Blah", JOptionPane.PLAIN_MESSAGE, null, options1, options1[0]);
    Variables.placeholder = (int) userValue1.charAt(0);This is the error I get
    C:\Documents and Settings\imholt\My Documents\OOPAttempt\21_Questions\Engine.java:170: cannot resolve symbol
    symbol : method charAt (int)
    location: class java.lang.Object
              Variables.placeholder = (int) userValue1.charAt(0);
    ^
    1 error
    I have a sneaky suspicion that once I find out what the problem was, I will ask myself why I didn't see it before...

    Try this
    Object userValue1 = JOptionPane.showInputDialog("Blah Blah Blah", JOptionPane.PLAIN_MESSAGE, null, options1, options1[0]);
    String str = userValue1.toString();
    Variables.placeholder = (int) str.charAt(0);

  • Please Help - Very strange problem with internal String encoding

    I created a file in one-byte russian encoding cp1251 and declared String literal with 2 letters:
    String str = "ab"; //attention! ab - two russian characters
    After I got bytes from it - str.getBytes("cp1251") - it returned 2 byte's array.
    Now I created a file with UTF-8 encoding with equal content and suddenly:
    After I got bytes from it - str.getBytes("cp1251") - it returned 4! byte's array. Why?
    I need to get a one-byte encoded arrays (cp1251 or koi8-r) but getBytes ALWAYS returns two-byte encoded arrays.
    It is very strange: cp1251 is always one-byte encoded, but .getBytes("cp1251") returns two-byte on each letter. Why? Please help.

    I did not read a string from a file. I created 2 .java files with different encodings (cp1251 and UTF-8) and compiled them, telling compiler with -Dfile.encoding=*** to read them correctly. While execution java interprets two looking equal in editor strings as different objects with different .intern() representation.
    Why java consider source .java file encoding while creating internal representation of String object and creates from looking equally in editor strings two DIFFERENT Unicode representations. And it is impossible to convert one representation to other - impossible to get two equal byte[] arrays.

  • Get first character from a String

    Hi!
    I've got a problem with the login of my program:
    I want to get the first character out of a String to select two types of users.
    eg.
    login "a20202" --> a --> first kind of user or
    login "b20202" --> b --> second kind of user
    Can you please help me?
    Bye
    Liz

    Am I on way to challenge the Worst Code Awards 2004 ? Let me have a go ... It is a far superior code-generating version :)
    Kept to ascii-range for the benefit of your monitor (and eyes):class NoMyWayIsFarSuperior {
         public static void main(String[] args){
              System.out.println("public static char getFirstChar(String message){");
              for(int k = 0; k < 256; k++){
                   System.out.println("  if(message.charAt(0) == " + k + ") return '" + ( (char) k) + "';");
              System.out.println("  throw new Exception(\"First char not within ascii range ... Please try again.\"); ");
              System.out.println("}");
    } The potential for optimisation is endless! :)

  • Please help! first website! movie clip placed on main timeline wont play!

    Hi! if any one could please help me it would be greatly
    appreciated!
    So im trying to make my first website in flash and ive ran
    into a problem. I have the main movie, my main time line. I have a
    few animations going on in this that were all created in that main
    time line. those work fine. however, i created two new movie clips
    (still inside the same .fla file) and animated them with thier own
    time line. I then thought you could just drag and drop these movie
    clips onto your main time line and they would play inside the
    movie. but when i press ctrl + enter, the dont play!
    here are some points of intrest.
    my main movie (the main time line) is 130 frames.
    the movie clips i made inside the same .fla file are between
    400 and 600 frames.
    i placed both new movie clips on the 130th frame in the time
    line with their own layers.
    also there is a layer for actions on the 130th that has
    stop();
    i thought that maybe the time line had to be as long as those
    movie clips i created and so i extended it but they still didnt
    play.
    im thinking action script is involved? please help me im
    getting pretty frustrated and im sure there is something simple to
    achieve this.
    here is a link where you can download the source files im
    using. if you open the file the two movie clips i created are
    called front two and front one and are layers with the same name.
    this board wont let me fully post my link cause the last word
    in it is s*h*i*t* so youll have to type it in your browser. its
    http://public.me.com/matts*h*i*t*
    (just remove the asterisks)
    also i noticed that my file is huge. i used photoshop to
    create everything and them imported it into flash. is there a way i
    can reduce this size?
    thank you sooo much! please help!
    -Matt

    Hey Matt,
    I'll take a look at your file, but as a general rule, a
    movieclip's timeline plays automatically when it is first
    instantiated. Instatiated means its first frame where "it exists"
    on the timeline that contains it. So the layer that holds your
    movieclip animation, needs to extend the length of the timeline you
    want that movieclip to "exist". Other than that rule, the frames
    don't NEED to match the frames inside said movieclip.
    So, if movieclips play automatically, and yours isn't, there
    must be something either stopping the movieclips timeline, or your
    movieclip isn't existing on the timeline because the layer that
    holds it, doesn't have keyframes the length you need it to.
    Yeah optimizing your sprites (2d graphical elements), and
    using vector when you need to (if you don't know the difference
    between raster and vector, google it) will significantly lower your
    outputted .swf file size.
    Edit: After looking at your file, your movieclips are not
    playing (well, they're technically playing, just not showing up)
    because your masker layer has multiple objects on it. A masker
    layer (not to be confused with the maskee layer, the layer being
    masked) needs to have only one object on it, or else you break the
    mask. The grey border of your mask movieclip needs to be deleted
    before your animation will play.

  • Strip the first character from a string

    i am trying to strip the leftmost character from a string
    using the following:
    <cfset Charges.DTL_CHG_AMT_EDIT =
    #Right(Charges.DTL_CHG_AMT_EDIT,Len(Charges.DTL_CHG_AMT_EDIT)-1)#>
    i keep getting the following error:
    Parameter 2 of function Right which is now -1 must be a
    positive integer

    > RemoveChars() much easier than Right()? How so?
    Semantically, if the object of the exercise is to *REMOVE
    CHARacters from a
    string* (which it is, in this case), it is simply better
    coding to use
    removeChars() rather than right(). That, and it's one less
    function call
    (the RIGHT() solution also requires a call to LEN() for it to
    work).
    So removeChars() is "easier" because it reflects the intent
    of the exercise
    directly, is simpler logic, is easier to read, and - I can't
    be arsed
    counting keystrokes - is probably less typing.
    That'd be how.
    Adam

  • Replace the first character in a String with blank

    String a = dgramRsp.getAddress().toString();
    a = a.replace('/','');The problem with the first statement is that it returns an ip address with a '/' in front of it. Like so.../192.168.0.190
    I need to get rid of the '/'. The replace won't work because it wants a character between the ' '. Thanks for your time.

    I had to think about it for a sec but yes you're
    right.
    InetAddress a = dgramRsp.getAddress();
    String b = a.getHostAddress();
    substring(1) would have worked, too, but it would have been redundant (removing a previously added slash).

  • Please help with first time PC build

    As a guy coming from a 8 year old 3,1 MacPro into PCs I need a bit of help evaluating all the different combinations when it comes to building a PC.
    I'm woking in CC mainly with After Effects and Premiere. In AE I'm working with Element 3D/optical flares, getting into some C4D.
    Premiere mainly with HD and Blackmagic cinema dng & prores. Working with some 4k Red footage. Additional CC applications but After Effects and Premiere are the main concern. Also, hoping to use Resolve, but haven't.
    I'm not going to be building it myself, there is a computer place that will be assembling and this was their suggested build with parts that they usually use with workstations along with some of my input from looking online. I think the vast amount of work they do is for gamers, and since I won't be gaming at all I want to make sure this is a solid work machine.
    Motherboard : 2011-v3 : ATX : X99S SLI PLUS : MSI
    CPU : Intel Core i7 5820K (6 x 4.0 GHz Overclock, 12 x threads)
    Case : ATX : No PSU : P70 Silence (Black) : Antec
    PSU : 750W : Smart Standard 80 Plus : SP-750PCBUS : Thermaltake
    RAM : Desktop DDR4 : 16GB/Kit : PC4-17000 : Crucial
    Cooling : CPU : Liquid : 120mm : Kuhler H2O 650 : KuhlerH2O650 : Antec
    Video Card : PCI-E : NVIDIA : GTX 970 : 4GB : ZT-90101-10P : Zotac
    HD : SSD : 250GB : SATA3 : Samsung 850 EVO (OS, Programs)
    HD : HDD : 2TB : SATA : WD2003FZEX Black : Western Digital (media, projects)
    HD : SSD : 500GB : SATA3 : BX100 Series : CT500BX100SSD1 : Crucial (media cache, previews, exports)
    I have a couple of 500GB 7200 seagate drives that were in my mac pro that I will probably bring over to keep photos, documents and other personal stuff.
    I have a 3TB caldigit vr raid that I'm thinking I can connect to the pc via esata
    As a potential extra I'm considering a 4TB backup drive where I can copy everything over incase of a drive failure.
    I appreciate any input, thanks

    Thanks,
    I've been reconsidering my build in light of what you said and I'm hoping you could look it over.
    PSU - EVGA SuperNOVA 850 - $174.99
    CASE - Fractal Design Define R5 - $139.99
    I'm still not sure about cooling. The R5 has 2 fans included, on on the back and one of the front. Is that enough or do I need another?
    CPU cooler - From what I understand I will still need a fan on the CPU and I've seen the Noctua NH-D15 and Cooler Master Hyper 212 EVO on other forums. Thoughts?
    I have no experience over clocking so I'm thinking I will just leave the CPU as is.  Correct me if I'm wrong but I've heard the 5820 is a better price/performance value than the 5930 so I'm thinking it's worth it to save the $250. Unless this CPU only makes sense if you OC
    CPU - i7-5820K Haswell-E 6-Core 3.3GHz- $469.99
    Motherboard - Asus 99-A - $334.99
    Originally I had the regular Crucial Ram picked out but It looks like the Crucial Ballistix Sport has a higher speed and is on sale for basically the same price. Latency is 15 for the regular and 16 for the ballistix? Is that the right call?
    RAM - Crucial 32GB (4x8GB) DDR4 2133 PC4-17000 - $449.99
    OR
    RAM - Crucial Ballistix Sport 32GB (4x8GB) DDR4 2400 PC4-19200  - $439.99
    Video Card - GIGABYTE GV-N970G1 Gaming-4GD GTX 970 - $449.99
    System Drive - Samsung 850 Pro 256GB - $194.99  2 of these one for system and another for media cache, previews, and exports.
    Am I forgetting anything?
    Thanks for taking a look

  • Please Help in Buffered Reader getting error.....

    Getting error
    java.lang.NumberFormatException: For input string: ""
         at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
         at java.lang.Integer.parseInt(Integer.java:468)
         at java.lang.Integer.parseInt(Integer.java:497)
         at charread.main(charread.java:18)
        import java.io.*;
        class charread
            InputStreamReader ir=new InputStreamReader(System.in);
            BufferedReader br=new BufferedReader(ir);
            public void main()throws IOException
                InputStreamReader ir=new InputStreamReader(System.in);
                BufferedReader br=new BufferedReader(ir);
                System.out.println("enter a character");
                char p=(char)(br.read());
                System.out.println("entered character = "+p);
                System.out.flush();
                System.out.println("enter a number");
                String s=br.readLine();
                int n=Integer.parseInt(s);
                System.out.println("enter a number = "+n);
            Please Help.....

    JoachimSauer wrote:
    First you read a single character, then you read the rest of the line.
    You probably entered a character and pressed enter.
    read() returned the character, readLine() returned the rest of the line, which is an empty String. And empty String can't be converted to an int.
    It's probably the easiest approach to just replace read() with a readLine() and take the first character of that String (after verifying that there is a character and optionally that there's only one character in that String).Alternatively you can call readLine() after you read the char.
    However this is merely a quick fix and I am concerned about other aspects of your program.
    InputStreamReader ir=new InputStreamReader(System.in);
    BufferedReader br=new BufferedReader(ir);The alternative to wrapping a BufferedReader around an InputStream is to use a Scanner, contrast the above example with the one below:
    Scanner sin = new Scanner(System.in);
    System.out.flush();Calling flush in this situation in unnecessary.
    int n=Integer.parseInt(s);Place the following code in a try/catch block every single time you parse a String from a user into an Integer in case an Exception occurs, e.g. user enters a word or letter.
    Integer n = null;
    while(n == null) {
      try {
        String s = br.readLine();
        n = Integer.parseInt(s);
      } catch(NumberFormatException e) {
        System.out.println("Please enter an Integer");
    }Finally onto Class naming conventions, Class names begin with a capital letter, variables and methods begin with a lower case letter.
    class charreadAvoid naming methods "void", especially with a return value of null. Or one might think, well in my case anyway that this is the entry point into your application.
    public void main()Mel

  • On my ipod touch my songs start in random places and jump to different places as it plays, the remember position is not ticked can anyone please help?

    On my ipod touch my songs start in random places and jump to different places as it plays, the remember position is not ticked can anyone please help?

    First, try a system reset.  It cures many ills and it's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until the screen blacks out or you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.
    If the Reset doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    Finally, if the Restore doesn't work, let the battery drain completely.  Then recharge for at least an hour and Restore again.

  • Still..Fetching Problem..Please Help

    Hello! Below is the code snippets of my program to test the setFetchSize() method. When run, it still retrieves all the contents of the table. I just need to retrieve say 4 items per page. Please help. Thanks.
    int skucd = 0;
    String skudesc = "";
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:dsShopCart", "", "");
    Statement stmt = con.createStatement();
    stmt.setFetchSize(4);
    ResultSet rs = stmt.executeQuery("SELECT * FROM tblProduce");
    while (rs.next())
    skucd = rs.getInt("sku_code");
    skudesc = rs.getString("sku_desc");
    System.out.println("Sku Code-"+skucd +"/Desc-"+skudesc);

    Using Stqtement.setFetchSize() one can only provide the JDBC driver a hint as to how many records the driver code should actually fetch from the database whenever it has reason to fetch results physically from the database and the driver is free to ignore that hint as well.
    However, the point to be noted in your case is that when a JDBC driver actually fetches results from the database depends on the specific driver implementation. For example, this may happen not only when one invokes Statement.executeQuery() etc but later on, for example when one invokes some method that performs some row operation on the result set. So, using setFetchSize() one can provide a hint to the driver as to how many records to physically fetch from the database whenever there is such a need to physically fetch from the databse.
    As far as I know, one has to implement some kind of paging model over the results by onseself.
    If you are involved with diaplaying results on an HTML page, tis might help http://jsptags.com/tags/navigation/pager

  • Please help me, boolean function

    Hello everyone, this is my first post in this forum. I have this function but I cant get it to work because I get this "missing return statement". Im desperate now, I cant figure how to fix it. Please help me.
    public static boolean es(String inst) {                              // Verificador de validez
              int ad=inst.indexOf("ADELANTE");
              int at=inst.indexOf("ATRAS");
              int iz=inst.indexOf("IZQUIERDA");
              int de=inst.indexOf("DERECHA");
              int bo=inst.indexOf("BORRAR");
              int ho=inst.indexOf("HOGAR");
              double numero;
              try {
                   if ((ad==0)&&(inst.charAt(8)==' ')) {
                        numero = Double.parseDouble(inst.substring(9));
                        if (numero>0)
                             return true;
                        else return false;
                   if ((at==0)&&(inst.charAt(5)==' ')) {
                        numero = Double.parseDouble(inst.substring(6));
                        if (numero>0)
                             return true;
                        else return false;
                   if ((iz==0)&&(inst.charAt(9)==' ')) {
                        numero = Double.parseDouble(inst.substring(10));
                        if ((numero>0)&&(numero<360))
                             return true;
                        else return false;
                   if ((de==0)&&(inst.charAt(7)==' ')) {
                        numero = Double.parseDouble(inst.substring(8));
                        if ((numero>0)&&(numero<360))
                             return true;
                        else return false;
                   if (bo==0) return true;
                   if (ho==0) return true;
                   else return false;
              catch (NumberFormatException ex) {
         }The objective of this function is to check if the user entered one of these words: "adelante", "atras", "izquierda" or "derecha" followed by a positive number. Thank you in advance for your help.

    you need to have a return statement at the very end of you method.
    here's a rewrite of what you provided...instead of a bunch of returns everywhere, i set a variable to return. i also put else if statements instead of if since you only want to see if one of the instances exist
    public static boolean es(String inst) {                              // Verificador de validez
              int ad=inst.indexOf("ADELANTE");
              int at=inst.indexOf("ATRAS");
              int iz=inst.indexOf("IZQUIERDA");
              int de=inst.indexOf("DERECHA");
              int bo=inst.indexOf("BORRAR");
              int ho=inst.indexOf("HOGAR");
              double numero;
              boolean answer = false;
              try {
                   if ((ad==0)&&(inst.charAt(8)==' ')) {
                        numero = Double.parseDouble(inst.substring(9));
                        if (numero>0)
                             answer = true;
                        else answer = false;
                   else if ((at==0)&&(inst.charAt(5)==' ')) {
                        numero = Double.parseDouble(inst.substring(6));
                        if (numero>0)
                             answer = true;
                        else answer = false;
                   else if ((iz==0)&&(inst.charAt(9)==' ')) {
                        numero = Double.parseDouble(inst.substring(10));
                        if ((numero>0)&&(numero<360))
                             answer = true;
                        else answer = false;
                   else if ((de==0)&&(inst.charAt(7)==' ')) {
                        numero = Double.parseDouble(inst.substring(8));
                        if ((numero>0)&&(numero<360))
                             answer = true;
                        else answer = false;
                   else if (bo==0) answer = true;
                   else if (ho==0) answer = true;
                   else answer = false;
              catch (NumberFormatException ex) {
    answer = false;
              return answer;
    Message was edited by:
    muzic

  • TestStand database logging problem: only the first character is put in the table.

    I am using TestStand 2.0.1 and Microsoft SQL server database. There is a weird problem when I use database logging. At first, all the database logging ran good.
    Then one day after I moved the test equipment to production line, TestStand only logs the first character of each string field in the tables! There is no error message.
    I setup another SQL server running locally on the same machine as the TestStand is and move the database to the local server, database logging has no problem. Schemas in TestStand Dabasebase Options are the same.
    I tried to run TestStand from another computer on the network. There was no problem before, too.  But now, TestStand always shows a Run-time error message like this:
    Details:
    An exception occurred calling 'LogResults' in 'ITSDBLog' of 'DBLog 1.0 Type Library'
    An error occurred executing a statement.
    Schema: New.
    Statement: STEP_RESULT.
    Connection failureMultiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
    Source: TSDBLog
    Error Code:
    -2147467259; User-defined error code.
    Location:
    Step 'Log Results to Database' of sequence 'Log To Database' in 'Database.seq'
    I have checked that the connection is good and also the table UUT_RESULT has been logged correctly.
    Anyone can help?
    Thanks.

    Thank you very much, Santiago.
    Yes, I have a customized schema, but it is based on the pre-existing schema. I tried the schema:TS 1.x Access/SQL (NI), which  came with TestStand, the results were the same. 
    I have tried to run different sequences. On one computer, I always get only the first character of each string entry logged in the remote database, however for the local server, everything is fine. On the other computer, there is no local SQL server, I always get similar error message as I mentioned in my post. The sequence step reports error is  "Log Results to Database".
    Any more suggestion?
    Thanks again.
    Best regards,
    Jaso

  • InDesign CS5 is not opening after deactivation/activation. How can I fix this? Illustrator and Photoshop open and are working fine. Please help!

    InDesign CS5 is not opening after deactivation/activation. How can I fix this? Illustrator and Photoshop open and are working fine. Please help!

    First of all, thank you for replying so promptly to my posts this morning!
    I can't remember how I got the software on his computer, but I'm pretty sure it wasn't through migration assistant.
    I was looking into doing an uninstall of InDesign and a fresh install. However, I initially downloaded the CS5 suite digitally and I can't find out how I am able to perform a fresh install of InDesign. Do you know where I find this info or gain access to download just InDesign again? I can't seem to find anything in my Adobe account that shows where I might do another download.

  • Proxies for Mac OS X have been shut down. Please help!

    all my proxies have been shut down in mac osx. im trying to find automatic proxy config and i need a .pac file. where would i get one? i am a newb when it comes to proxies so i need all the help i can get. i want to enable HTTP and HTTPS proxies and any others that i may need. please help.

    HelsBels1986, first power the computer down, now wait a few minutes until the machine is complete settled. Now press the startup button and restart while holding down the Option key. This should Open Startup Manager and give you a choice of startup disks, choose the Tiger Disk as your startup drive. Once the disk mount choose English, then go up to the Main Menu to Utilities and scroll down to Disk Utility. Once DU opens choose your start up drive in the upper hand column of the window an run Disk Repair from First Aid in the upper Tabs. Now check the SMART Status of your hard drive at the bottom of the window, it should say Verified. Next select your startup volume in the left column and run Repair Permissions.
    If all checks out go back up to the Main Menu/Utilities/Startup Drive and choose your hard drive and choose Restart.
    Joe

Maybe you are looking for