How to Identify the Same Characters in 2 Different Strings

Hi All,
I am requiring a suggestion on how to identify the same characters in 2 different Strings, for example:
String str1 = "hello";
String str2 = "llheo";
Both Strings contain the same characters, but in a different order, so what would be the best technique to verify t that both Strings indeed contain the same characters?
I was personally thinking along the lines of using the class, java.util.regex.Pattern?
Any thoughts would me much appreciated. Thanks

I would instead sort the characters, and then compare
the sorted data.
I'm fealing generous
    private static boolean anagram(String left, String right)
        if (left.length() != right.length())
            return false;
        char[] leftChars = left.toCharArray();
        char[] rightChars = right.toCharArray();
        Arrays.sort(leftChars);
        Arrays.sort(rightChars);
        return Arrays.equals(leftChars, rightChars);
    }

Similar Messages

  • How to use the same OC4j server with different port number

    How to use the same OC4j server with different port numbers..?
    I have to OC4J installed on my machine on different hard disk drives....
    I want to be able to run both the server simultaneously..?
    is it possible ..it yes then how..?
    for that i have changed the port number of one server...
    but when i am trying to start the other server with different port number..it says that JVM -Bind already...
    Is there any clues...?
    Nilesh G

    In the config directory:
    default-web-site.xml: Change the port the HTTP listener listens on
    jms.xml: Change the port the JMS service listens on
    rmi.xml: Change the port the ORMI listener listens on.
    Or, you can add another web-site.xml file, and deploy your applications to 1 server, and bind the web applications to the different web sites. This way you only have to deploy your applications to 1 place.
    Rob
    Oracle

  • How to download the same song(track) with different keys? iTunes seems to think I have already downloaded the song and will not download the song in a different key of the Demo Track

    How to download the same song(track) with different keys? iTunes seems to think I have already dowloaded the song and will not let me download the song in a different key or the Demo.

    Hello Jigz19,
    It sounds like you are unable to play a couple of songs from your library becuase you get a message that the computer is unauthorized to play, but other content purchased that same day works without issue. I would verify that the affected songs were purchased with the same Apple ID first:
    Recovering a forgotten iTunes Store account name
    http://support.apple.com/kb/ht1920
    Open iTunes
    Highlight one of the items you have purchased (You can find your purchases in your Purchases playlist).
    Choose File > Get Info.
    Click the Summary tab.
    The Account Name area will list the account used to purchase the item. Unless you have changed accounts, this is your iTunes Store account name.
    If so, then delete the songs:
    How to delete content you've downloaded from the iTunes Store, App Store, iBooks Store, or Mac App Store
    http://support.apple.com/kb/HT5772
    Then re download them with this article:
    Download past purchases
    http://support.apple.com/kb/ht2519
    Thank you for using Apple Support Communities.
    All the best,
    Sterling

  • How to identify the special characters

    Hi all,
    is there any way to identify all the special characters that are already in the various columns of a table,
    thanks
    db is on 8i
    Edited by: venkata_sudheer on Apr 3, 2009 8:44 AM

    Hello,
    I don't know what's your requriment is and how do you want to handle or treat these special characters but check this function, you can pass special character and it will return back the number or you can extend this function to do the reverse (chr(37) 37=%).
    CREATE OR REPLACE FUNCTION ascii_only (p_txt IN VARCHAR2)
       RETURN VARCHAR2
    IS
       v_number   NUMBER;
       v_char     VARCHAR2 (3 BYTE);
    BEGIN
       v_char := SUBSTR (p_txt, 1, 1);
       v_number := (ASCII (v_char));
       DBMS_OUTPUT.put_line (v_number || ':' || v_char);
       RETURN v_number;
    END;
    /Regards

  • HR - How to identify the list of infotype populated for a pernr.

    Hi,
    When we go to pa30 tcode, and input a pernr and press enter, we can see the list of infotype populated for the particular pernr with a "tick" symbol.  I would like to know, how SAP identify the same.  Is there any table in which these information is stored.
    Please do let me know the detail asap.  This is urgent to me.
    Regards
    Gopalakrishnan S

    Hi,
    You can run a report named "RPLINFC0" to get list of infoypes which are used for a PERNR.
    I think its enough for you.
    Regards,
    Purnima

  • Urgent ! Assigning (or Linking ) the same workbook into two different roles

    Hi Gurus,
    Coul you tell how to link the same workbook to two different roles.
    I am assigning the same workbook to two different roles, but in the second role the workbook is displaying with different structure than in the first role. I want the workbook should be displayed with same structure in both the roles.
    This is Urgernt.
    Thanks in advance.
    Best regards
    Hari

    Hello hari,
    Both the roles should diplay the same layout for a single workbook.
    please ensure that both the users(with these 2 roles) have similar (all the other)authorisations.
    it's possible that one of the users may have further restrictions in authorisations. check out for z-authorisation objects if any.
    hope it helps..
    thanks,
    (*Don't forget to Assign points on SDN)

  • How to identify the user who created the variant

    Hi All,
    Can anyone tell me how to identify the user who created the variant ?

    Hi Dear,
    For the same go to SE11 and view the table "VARID". This table give the details of the program,user,variant etc.
    From this table u can know which user created the variant. Hope this solve your purpose.
    Regards

  • How to identify the encoding used in a file ?

    Hi all,
    I have to read a file and check it is encoded in UTF-8. How I can do this ?. If fiel is saved in MS Windows I can check for BOM. What if the file is saved using Java API ?. Is there any code(copy left code) available for doing this ?
    rgds
    Antony Paul

    The problem is that ther eare no definite tests for character encoding. A particular byte stream can be valid in any number of different encodings (even if the resulting characters are not correct). If the characters don't happen to include any above unicode 127 then a UTF-8 stream is identical to the same characters in any number of different encodings.
    It's not just a matter of there being no code for it in the library, it's impossible to do with any certainty, and to do it even probabalistically you'd have to run the results through a multi-lingual spelling checker.
    If you just ask java.io to open a Reader without specifying an encoding it will assume the default encoding of your system.

  • How to identify the t-codes like s_alr-* t-codes

    Hi, Please advise how to identify the s_alr t-codes in the r/3 system. for example, we can set the config of same node with op40 t-code as well as with S_ALR_87006275 t-code. how to know the s_alr_*** t-codes in sap system. thanks for your support.

    Raju,
    Although OP40 and S_ALR_87006275 may look the same to you, they are not the same.
    You can review information about transactions using the repository (SE84 > other objects > transactions) to find out more about them.  As mentioned by the other gurus, you can also do a table lookup to find out the transaction names that exist.
    Don't expect any kind of consistency in the way SAP deals with transactions assigned to configuration nodes.   There isn't any.  Not all IMG nodes will have s* transactions assigned to them.  Actually, many nodes have no transactions assigned to them.
    Best Regards,
    DB49

  • How to identify the Oracle Edition ?

    Hai All,
    How to identify the oracle edition ( standard, enterprise etc...) running in a machine?
    Please help
    Shiju.

    Even if you have explicitly deselected the additional feature of the Enterprise Edition, If you have installed Oracle Enterprise Edition, then you have an Oracel Enterprise Edition Installed, and you must have a license to support your installation. There are several kinds of Edition, you may choose the one that best fits your needs.
    Oracle Enterprise Edition:
    Enterprise Edition is the full (top of the range) version or the Oracle Database Server. Options like RAC, Partitioning, Spatial, etc. can be purchased separately to enhance the functionality of the database.
    Oracle Standard Edition:
    Standard Edition is designed for smaller businesses and enterprises. It offers a subset of the features/ functionality implemented in Enterprise Edition. Database options like Data Guard, Partitioning, Spatial, etc. is not available with Standard Edition (from 10g one can use RAC with Standard Edition). Standard Edition can only be licensed on servers with a maximum capacity of four processors.
    Oracle Standard Edition One:
    Standard Edition One is a low cost, entry-level version of the Oracle Standard Edition database server. Standard Edition One can only be licensed on small servers with a maximum capacity of two processors.
    Oracle Personal Edition:
    Personal Oracle is a single user version of the database server. It is mostly the same as Enterprise Edition, but doesn't support advanced options like RAC, Streams, XMLDB, etc.
    Oracle Lite:
    Oracle Light is a database engine that can be used on mobile platforms like cell phones and PDA's.
    Oracle XE:
    Express Edition (XE) is a free, downloadable version of the Oracle database server. Oracle XE can only be used on single processor machines. It can only manage up to 4 GB of data and 1 GB of memory. ISVs can embed XE in 3rd party products and redistribute it freely.

  • How to use the same POWL query for multiple users

    Hello,
    I have defined a POWL query which executes properly. But if I map the same POWL query to 2 portal users and the 2 portal users try to access the same page simultaneously then it gives an error message to one of the users that
    "Query 'ABC' is already open in another session."
    where 'ABC' is the query name.
    Can you please tell me how to use the same POWL query for multiple users ?
    A fast reply would be highly appreciated.
    Thanks and Regards,
    Sandhya

    Batch processing usually involves using actions you have recorded.  In Action you can insert Path that can be used during processing documents.  Path have some size so you may want to only process document that have the same size.  Look in the Actions Palette fly-out menu for insert path.  It inserts|records the current document work path into the action being worked on and when the action is played it inserts the path into the document as the current work path..

  • How to register the same schema with same URL

    I'm getting ORA-31085 error when try to register the same schema with same URl.
    My requirement is that I should be able to reregister the same schema with the same URL .
    I'm using the following function :
    PROCEDURE validateXmlSchema(inp_xmlMsg IN VARCHAR2,
    out_isValidDoc IN OUT NUMBER,
    inp_xmlSchema IN OUT VARCHAR2,
    out_varchar_notused OUT VARCHAR2)IS
    xmldoc XMLType;
    res number;
    BEGIN
    xmldoc := XMLtype(inp_xmlMsg);
    res := xmldoc.isSchemaValid(inp_xmlSchema);
    IF (xmldoc.isSchemaValid = 1) THEN
    out_isValidDoc := 1;
    ELSE
    out_isValidDoc := 0;
    END IF;
    END validateXmlSchema;
    This is used recursively.Until the schema is not validated for a given URL this function should keep on throwing error and once the schema is validated the data should be inserted in the DB.
    But its not happening as of now instead the ORA-31085 is thrown second time.
    Plz provide pointers to solve the issue.

    "mjs" <[email protected]> wrote in message
    news:g7kjk5$o6$[email protected]..
    > "mjs" <[email protected]> wrote in message
    > news:g7gl2g$i3d$[email protected]..
    >> "Zorrrro" <[email protected]> wrote
    in message
    >> news:g7gcjv$a6n$[email protected]..
    >>> I'm completely nuckered trying to find an answer
    for this...
    >>>
    >>> Does anyone know how to keep the same width an
    position of the submenus
    >>> of a
    >>> horizontal dropdown menu?
    >>> Thank you in advance.
    >>>
    >>> Cheers.
    >>
    >> Doesn't a simple style="width:200px" in the input
    tag work?
    >
    > I'll asume the answer is "yes", then. ;) You're welcome.
    I believe the OP is talking about a dropdown menu like this
    one
    http://www.tjkdesign.com/articles/keyboard_friendly_dropdown_menu/default.asp
    not about a "select menu".
    I could be wrong though...
    Thierry
    Articles and Tutorials:
    http://www.TJKDesign.com/go/?0
    http://developer.yahoo.com/
    helps you build applications and mashups

  • I have multiple devices backed up to the same computer each with different data. how do i keep them from syncing all data when i back up or transfer stuff from the computer to a device?

    i have multiple devices backed up to the same computer each with different data. how do i keep them from syncing all data when i back up or transfer stuff from the computer to a device? one is an iphone 6 and the others are ipad mini first gens, each ipad has 64gb and the iphone has 128, need to keep the data seperate as they are not all mine

    Itunes content and pics are NOT part of the backup that itunes performs.
    Backing up, updating, and restoring iPad, iPod touch, and iPhone software
    You should transfer any purchases from iphone regularly:  File>Transfer Purchases  , if they fail to be transferred when you sync.
    You buy one and only one download.  It is your responsibility to move/copy/backup your purchases.
    You can try contacting itunes support and asking for an exception, but they are under no obligation to allow.
    http://www.apple.com/support/itunes

  • How do i backup my iphone 3 started on one itunes account and restore to the same phone with a different itunes account without losing all my information?

    how do i backup my iphone 3 started on one itunes account and restore to the same phone with a different itunes account without losing all my information?

    Please search the forums. This has been covered here extensively.

  • How to Use the same iview for both KM End User and the KM Administrator

    Hi friends,
    *This is my scenario :* How to Use the same iview for both KM End User and the KM Administrator but with different Context
    Menu Options.
    i followed these steps but im getting same context menu for both KM End User and the KM Administrator .
    Assign the role Content Administrator to the user km_admin. This is needed so that km_admin can change
    the presentation settings for the KM Folder u201EReports_kmFolder‟.
    Now, login with user km_admin. Navigate to the Km Folder reports_kmFolder through Content Administration
    -> Km Content. Click on Details link of the folder reports_kmFolder.
    Go To Settings -> Presentation. Click on the tab u201ESettings for You‟-> Click on button u201ESelect Profile‟.
    Select the radio button corresponding to u201Elayout Set‟, and choose u201EConsumerExplorer‟ from the dropdown.
    Click u201EOK‟.
    Select both the check boxes corresponding to Items Affected as shown above, and click u201ESave‟
    Now, remove the u201ESuper Administrator‟ role from the user km_admin and login with this user.
    How rto resolve this????
    Regards,
    Prasad.

    Hello Prasad,
    Most likely the user km_admin still has system principal roles assigned, even though you removed the Super Admin role, you should check that this user doesn't have any other admin roles, otherwise it will be considered a System Principal user and will therefore still have access to all content. For more information see http://help.sap.com/saphelp_nw70/helpdata/en/19/56f28fbd4e11d5993b00508b6b8b11/frameset.htm
    Try creating a new user with just read access to the content and you should see that it will not be able to make any changes etc.
    Regards,
    Lorcan.

Maybe you are looking for

  • How to post parked vendor credit memo after clearing that invoice

    Hai I had an issue where the user is trying to post the parked credit memo and he is getting the error. I had investigated that and found there for that vendor already Invoice amount already paid. After making the payment to vendor with respect to In

  • Copy PO order in SRM not replicating new net price in ECC (SAP SRM 7.0 )

    Hello - I'm in SRM 7.0 SRM Server 701 level 4 and ECC 6.0 I I'm copying an already order PO from POWL (copy), I change the Gross Price in SRM from X to Y and I order the new PO. I go to ME23n in ECC and the NET_PRICE value on the PO is still X even t

  • URGENT: Document help

    Hi folks, I need urgent help from u guys. I have involved in one small project,development work complete successfully. Now I need to prepare a PPT for this project (what actually we have done,what's client expectations,what are the learning's from th

  • Offline FIOS box

    Every time we have a power failure, our main living room box goes offline. Unplugging does not fix it. This is one of 4 in the house, but the only one that has problems. Motorola brand Any "home" remedies? twosilly Solved! Go to Solution.

  • Installing the Oracle Application server 10 g release 3

    Hi all, I installed the basic installation of the oracle application server 10g release 3.After installation i was able to get the Aggrespy page listing the performance metric tables.The problem is that the page is not getting displayed in xml format