dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Most efficient method to compare strings

  1. #1
    Join Date
    Mar 2004
    Posts
    32

    Most efficient method to compare strings

    I need to find an efficient method of comparing each character in one string to each character in another string.

    So for example, I will have a fixed 10 character string and I will want to compare it to each form field that is included in an HTTP request. As I cycle through the fields I will be doing the comparison.

    This will be done many times so I want to have as little overhead as possible.

    BTW I am using Java 2 - v1.3.1, so I do not have access to the regex package which came out with 1.4.

  2. #2
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    The only way that comes to mind would be as efficient as anything. Iterate through the parameters and use .equals() or .equalsIgnoreCase() to compare their values to your string.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles