How do i get the last 4 chars

String FileE = myFile.getName();
This gives me a file name but how do I a reverse trim and get the last 4 chars??

Hi
What are you trying to achieve here, why are you pulling a file into a String Buffer ?
fileName.getName() will output a string, you can use the following statement to get the last four characters of the filename
Here is an example
String fileName = "testfile";
String lastFourChars = fileName.substring(fileName.length()-4);
This will give you the last four characters of the filename.
But if you are trying to get the extension of the file
Do this
String extension = fileName.substring(fileName.lastIndexOf("."));
Thanks
Swaraj
Thanks
Swaraj

Similar Messages

  • How can I get the last updated email address of the customer ??

    Dear All,
    Please let me know, How can I get the last updated email address of the customer ??
    Also, I am trying to read CDHDR table where OBJECTCLAS is ADRESSE, however what value should be passed into OBJECTID field, looks like it is ADRNR with a Suffix BP.
    Please confirm me what value should be passed into OBJECTID field.
    Thank you.
    Anitha

    Hi Anitha,
      Check if this is something that helps you:
    Change documents in BAS
    CDHDR
    address type 1
    objectclass = ADRESSE             
    objectid = addrgroup + addrnumber     (ADRC-ADDR_GROUP + ADDRNNUMBER) !!
                     'BP  000xxxxxx'
    private address (address type 2)
    objectclass = ADRESSE2
    objectid =  'BP  000xxxxxx000yyyyyyy'   
                            persnumber+adrnr private
    address type 3
    objectclass = ADRESSE3
    objectid =  'BP  000xxxxxx000zzzzzzz'
                              persnumber +comp.address
    The above details is from the link: http://wiki.sdn.sap.com/wiki/display/ERPLO/LO-MD-BP
    Regards,
    Swarna Munukoti

  • I have an Ipod touch updated to last available ios 4.2.1. How can I get the last compatible versions of the apps?

    I have an Ipod touch updated to last available ios 4.2.1.
    How can I get the last compatible versions of the apps?
    In the appstore there are only the lat app versions, most of them are incompatible with my device.
    I know that previous versions of these apps were compatible with my ipod.
    Can all download them someway?
    thanks

    The problem is: I never had the compatible versions. But I want them, I'd buy them if I could.
    So I'm stuck with my Ipod, which can't be upgraded anymore to higher IOS versions, and with the appstore, that does not offer older versions; versions that have existed and still exist, perhaps in the recycle bin of some users, or somewhere in the appstore servers.
    I know, its a policy, just to sell more devices. Will not work with me. I'm not buying more Ipods

  • How do I get the last changed date & time of a file in app server?

    Hi Experts,
    How do I get the last changed date & time of a file in app server?
    Thanks!
    - Anthony -

    Hi,
    that's what I use...
      CALL 'C_DIR_READ_FINISH'.             " just to be sure
      CALL 'C_DIR_READ_START' ID 'DIR' FIELD p_path.
      IF sy-subrc <> 0.
        EXIT. "Error
      ENDIF.
      DO.
        CLEAR l_srvfil.
        CALL 'C_DIR_READ_NEXT'
          ID 'TYPE'   FIELD l_srvfil-type
          ID 'NAME'   FIELD l_srvfil-file
          ID 'LEN'    FIELD l_srvfil-size
          ID 'OWNER'  FIELD l_srvfil-owner
          ID 'MTIME'  FIELD l_mtime
          ID 'MODE'   FIELD l_srvfil-attri.
    *    l_srvfil-dir = p_path .
        IF sy-subrc = 1.
          EXIT.
        ENDIF." sy-subrc <> 0.
        PERFORM p_to_date_time_tz
          USING    l_mtime
          CHANGING l_srvfil-mod_time
                   l_srvfil-mod_date.
        TRANSLATE l_srvfil-type TO UPPER CASE.               "#EC TRANSLANG
        PERFORM translate_attribute CHANGING l_srvfil-attri.
        CHECK:
          NOT l_srvfil-file = '.',
          l_srvfil-type = 'D' OR
          l_srvfil-type = 'F' .
        APPEND l_srvfil TO lt_srvfil.
      ENDDO.
      CHECK NOT lt_srvfil IS INITIAL.
      pt_srvfil = lt_srvfil.
    FORM p_to_date_time_tz  USING    p_ptime  TYPE p
                            CHANGING p_time   TYPE syuzeit
                                     p_date   TYPE sydatum.
      DATA:
        l_abaptstamp TYPE timestamp,
        l_time       TYPE int4,
        l_opcode     TYPE x VALUE 3,
        l_abstamp    TYPE abstamp.
      l_time = p_ptime.
      CALL 'RstrDateConv'
        ID 'OPCODE' FIELD l_opcode
        ID 'TIMESTAMP' FIELD l_time
        ID 'ABAPSTAMP' FIELD l_abstamp.
      l_abaptstamp = l_abstamp.
      CONVERT TIME STAMP l_abaptstamp TIME ZONE sy-zonlo INTO DATE p_date
          TIME p_time.
    ENDFORM.                    " p_to_date_time_tz
    Regards,
    Clemens

  • Please help.........how can i get the last date of the month?????

    Hello....
    I want to get the last date of the month.
    For example, the last date of Jan is 31.
    How can I get the last date of the particular month and year ????
    Thanks for help.
    Gloria

    Hi Gloria
    1. How can I compare the date???date1.compareTo(date2)
    where date1 and date2 is a java.util.Date Object
    will return 0 if it is the same date
    or
    date1.after(date2)
    where date1 and date2 is a java.util.Date Object
    will return true if date1 is after date2
    (the same for date1.before)
    2. How can I change the date format into yyyymmdd format???? I just want the year, month and date.try the java.text.SimpleDateFormat Object
    new SimpleDateFormat("yyyymmdd").format(yourdate)
    Hope this help.
    Please also have a look at a calendar I wrote, (maybe it help)
    demo & source :
    http://www.geocities.com/globe_software/java/components/
    globe_sa

  • How can i get the lasted vision of visual administrator

    HI:
    when i connet j2ee engine,i get the system warning:
    "visual administrator vision is older than the version of j2ee engine kernel: ..."
    how can i get the lasted vision of visual administrator?

    Get your portal administrator to copy the j2ee/admin from the server you're trying to connect to.  You can then install and run it from your local hard drive.

  • How can I get the last 18 numbers from this string

    Hi,
    I'm querying this field from a table. How can I only get the last 18 numbers:
    The numbers look like this:
    500000000818118

    If it is always the last 18 numbers just use the Right() function.  Examples:
    Right("500000000818118", 18)
    or
    <cfset mystring = "500000000818118">
    <cfset mynewstring = Right(mystring, 18)>
    or
    #Right(yourquerycolumn, 18)#
    etc.
    Edit:
    Well I just noticed that your example string is only 15 characters long.  Perhaps I mis-understood your question?
    Message was edited by: Miguel-F

  • How do I get the last COLUMN in an Excel Sheet using Report Generation toolkit in LV7.1?

    I am trying to get the last column in an Excel sheet using the Report Generation toolkit. The function "Excel Get Last Row" does not give last column info. Is there a function that will do this?
    Thanks

    Hello –
    I think the following example program might be helpful to get you started programming your application.
    Get Excel Data from Specified Field.
    Hope this helps!
    SVences
    Applications Engineer
    National Instruments

  • How can I get the last / newest record of a table?

    Hi,
    I am developing an ecard app that has a create greeting page, a preview page with edit and send buttons and an edit page.
    I got he insert working, and on the preview page I created a master record page (displays all records), and delete all unecessary designs. Doing it this way also gives me the 'edit' button, so people are able to edit their page.
    How do I get only the last record displayed though? At the moment it loops through all records and displays them in sets of 10. I found the variable that holds the totla count of records ('$totalRows_rs7417_content1'), but how do I (re-)write the script so it ONLY diplays the last record?
    I need to get the ID of this record as I am writing this into the PARAMs of the object and embed tags of my message .swf (this picks up the ID and based on that sucks the greetings text out of the database via another php script.
    Also, from this page, how can I send an email to the sender (ie creator of the message) as well as the recipient? Both email addresses are in the databse so should be part of the erecord returned.
    Thanks,
    Nik

    -----
    OK, So how do I recreate what I got in a non-ADDT list?
    well, when you´re just about to display one certain record, the term "list" is somewhat inappropriate anyway.
    What you´d simply need to do IMHO, is using DW´s native functions to create the basic "SELECT * FROM table_name ORDEr BY ID DESC" query, add "LIMIT 1" manually, and display the desired "dynamic text" placeholders in 1 table cell -- don´t think there were any need for all the fancy stuff
    (sorting, filtering etc) provided by ADDT´s list, as it´s just 1 record.
    It also occurred to me just now that finding the last record that has been added *may-* notbe enough if the site gets used a lot by our executives (I am thinking of a situation where 2 or three peolpe create greetings at the same time and press submit and then getting each others messges rather than their own).
    in this case you might want to additionally store the respective executive´s "kt_login_id" session variable -- because it´s this unique "identifier" which should be used to show the last inserted record of the person who actually inserted it, means adding a "WHERE submitter_id" equals the session variable kt_login_id - clause to the query.
    When creating a non-ADDT list that´s at some point based on detecting a user session, you´ll BTW need to insert at line 1
    I can't seemt o insert it on the page as it is looking for a insert, update or delete bahaviour on the page which of course I don't have
    please search these forums for several posts I made which explain my "use dummy table" approach that´s made for cases when you actually don´t have anything to insert/update/delete, but need "something" for ADDT´s send email behaviours.
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • How can i get the last delete picture's info from tlf?

    if i delete the picture from the tlf i can't make the tlf undo
    and I want to get the picture'info with I last time delete from tlf 

    Can you let us know what you are doing to delete the picture, and also how you are undoing it? If it is being deleted through the EditManager delete function, the delete should undo correctly. Some example code to illustrate the problem would help.
    Once the picture has been deleted, TLF has no further reference to it. If you want to keep a reference, you will have to get it before it has been deleted. If you don't have control over the delete, you could find out when the image is deleted by listening for FLOW_OPERATION_END events.
    - robin

  • [JS][CC] How can I get the last visible character in an overflowed Text Frame?

    Hello
    I'm new in InDesign scripting in javascript. I would like to know if there is a way to get the position of the last character in a Text Frame that is overflowed? I need this because I want to calculate how many characters are hidden (overflowing text) via script.
    I've searched in the forums about this but what I find is always a script for alerting if there's overset text or not.
    I'd really appreciate any help!

    Well, let's say that myFrame is an overflowing text frame.
    So, the last character in that frame would be
    myFrame.characters[-1];
    To calculate the number of overflowing characters, select the
    overflowing text frame, and run this script:
    myFrame = app.selection[0];
    myParentStory = myFrame.parentStory;
    alert("Number of overflowing characters is
    "+myParentStory.characters.itemByRange(myFrame.characters[-1],
    myParentStory.characters[-1]).length-1);
    Ariel

  • How do I get the last or maximum value /

    Hi all,
    I got the following query output :-
    ITEM_______DATE____________PRICE
    AAA_______01/11/04__________2.5
    AAA_______22/04/05__________4.0
    BBB_______04/08/05__________44
    BBB_______05/08/05__________45
    CCC_______04/12/04__________12
    CCC_______05/05/05__________90
    I want to get the output of the last date, I'm try to use max(date), however, b'cos of the diff price the records still show. I just need the output of the last date, output will be something like below :-
    ITEM_______DATE____________PRICE
    AAA_______22/04/05__________4.0
    BBB_______05/08/05__________45
    CCC_______05/05/05__________90
    How should I code ?
    Rgds
    Lim

    SQL> drop table test_data
      2  /
    drop table test_data
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> create table test_data
      2  (item       varchar2(32)
      3  ,item_date  date
      4  ,price      number)
      5  /
    Table created.
    SQL>
    SQL> insert into test_Data values('AAA', to_Date('01/11/04', 'dd/mm/yy'),2.5)
      2  /
    1 row created.
    SQL> insert into test_Data values('AAA', to_Date('22/04/05', 'dd/mm/yy'),4.0)
      2  /
    1 row created.
    SQL> insert into test_Data values('BBB', to_Date('04/08/05', 'dd/mm/yy'),44)
      2  /
    1 row created.
    SQL> insert into test_Data values('BBB', to_Date('05/08/05', 'dd/mm/yy'),45)
      2  /
    1 row created.
    SQL> insert into test_Data values('CCC', to_Date('04/12/04', 'dd/mm/yy'),12)
      2  /
    1 row created.
    SQL> insert into test_Data values('CCC', to_Date('05/05/05', 'dd/mm/yy'),90)
      2  /
    1 row created.
    SQL>
    SQL> select * from test_Data
      2  /
    ITEM                             ITEM_DATE      PRICE                                              
    AAA                              01-NOV-04        2.5                                              
    AAA                              22-APR-05          4                                              
    BBB                              04-AUG-05         44                                              
    BBB                              05-AUG-05         45                                              
    CCC                              04-DEC-04         12                                              
    CCC                              05-MAY-05         90                                              
    6 rows selected.
    SQL>
    SQL> select * from test_data
      2  where (item_date, item) in
      3  (select max(item_date) item_date, item from test_Data group by item)
      4  /
    ITEM                             ITEM_DATE      PRICE                                              
    AAA                              22-APR-05          4                                              
    CCC                              05-MAY-05         90                                              
    BBB                              05-AUG-05         45                                              

  • How can I get the last known IP address of my stolen iPad?

    My iPad 16G Wifi was stolen with Find My iPhone turned on. It was broadcasting some coordinates yesterday, but the accuracy was not the best. Can I somehow get the IP address for this last online point? It would help to filter out some apartments in the building it was located.

    Sorry, but no. The Find My iPhone app is the only way to "locate" an iOS device.
    Reporting a lost or stolen Apple product

  • How can I get the last occurrence of a repeated item in Numbers

    Hi everyone, I'm hoping this question has a straightforward answer.
    I have a simple 2-column table (Table 1). Column A is a list of names. Column B is a list of dates where those names have had appointments. (Most names in Column A are repeated because they have had multiple appointments).
    I'd like to create an automated table based Table 1 that lists each name from Column A only once, with the last appointment that each person has had.
    Any ideas, I'd be grateful.
    Thanks!

    Hi Paul,
    Late to the party, as I was called to dinner shortly after starting on a solution and wasn't able to get back to it for a few hours.
    This was worked out in Numbers '09 (v2.3), but the formulas should work as well in Numbers 3. The solution requires the data on the Data table to be entered (or sorted) in ascending order of dates. Dulicate dates, though not included in the example, should not create an issue.
    The added column (Name index—column C) may be hidden. It is needed to mark the first occurrence of each name, and required only if you want the name list in column A of the summary table (Most recent appointment) filled automatically.
    Formulas:
    Data::C2, and filled down to the end of column C: =IF(COUNTIF($A$2:A2,A)=1,MAX($C$1:C1)+1,"")
    COUNTIF($A$2:A2,A) counts the number of occurences of the name in the same row as the formula from row 2 of column A to the row containing the formula. IF that count is 1, the number of the row is placed in the cell, otherwise the cell receives a null string ( "" ).
    Most recent appointment table:
    A2, and filled down to end of column A:
    =IF(ROW()-1>MAX(Data :: C),"",OFFSET(Data :: $A$1,MATCH(ROW()-1,Data :: $C,0)-1,0))
    If the row number minus 1 is greater than the number of distinct names in the index column, a null string is placed in the cell. Otherwise, the OFFSET function uses MATCH to determine the row in which to find the next name (in order of first appearance) and places that name in its cell.
    B2 and filled down: =IF(LEN(A)>0,LOOKUP(A,Data :: $A,Data :: $B),"")
    IF here uses LEN() to determine if there is data (a name) in column A. If so, then LOOKUP looks up the name in column A of the Data table and returns the date from the same row of column B. If there's no data (name) in column A, IF places a null string in the cell.
    This formula takes advantage of the fact that LOOKUP searches from the bottom of the column, and returns the result from the first match it finds.
    Regards,
    Barry

  • How can I erase the last char of string

    I have a string tha is printing as following
    129.111.13.1.
    I want to erase the last "." can somebody helpme?
    Thanks

    You will have to create a new String. Then you can get the string length. Then you will need to to use a substring to get the positions you want.
    Something like this
    String Orginal = "129.111.13.1.";
    String new_orginal = null;
    int num;
    num = Original.length();
    new_orginal = Original.substring(0,num-1);
    I hope it helps

Maybe you are looking for