Comparing each character of two words.

I want to compare individual characters of two words. What is the best option to do so?

Depending on what you mean by "similar", you may want to create a table of similar characters. For example, a character might be considered similar to another character if it's next to it on a QWERTY keyboard.
Another thing you may want to consider is number of deviations. What if every corresponding character between two strings is similar, not an exact match? Do you want to put a cap on the number of deviant characters?*
Do the deviant character have to appear only at the ends of words?
You may also want to look at the Soundex algorithm. Maybe there's an existing java implementation. Here's something I found from a quick google:
http://sourceforge.net/snippet/detail.php?type=snippet&id=100251
* I just wanted an excuse to say "deviant characters"

Similar Messages

  • Comparing each value of two internal tables

    HI  everybody,
    i have two internal tables  itab1 and itab2 same structure
    both r having four fields each and field with values
    now i need to compare the two internal tables
    and if every value of itab1 matches itab2
    then i have to write one select quirie  for the following given description
    compare past and current shipping point
    compare internal_table2 and internal_table3
    if entry in internal_table2 and internal table3 match
    variable_tknum = internal_table2-tknum
    endif.
    for each entry that matches:
    select vlabdata into zi_vlabdata from vlbl where vbeln = variable_tknum and vlbl-vlabtyp = 'ZIBOOKNO'.
    plz give me solution for this
    thanks
    hridhayanjili.

    sort : ITAB1 by f1,f2,f3,f4,
           ITAB2 by f1,f2,f3,f4.
    LOOP AT ITAB1.
      READ TABLE ITAB2 WITH KEY F1 = ITAB1-F1
                                F2 = ITAB1-F2
                                F3 = ITAB1-F3
                                F4 = ITAB1-F4 BINARY SEARCH.
      IF SY-SUBRC = 0.
    *--all the fields of ITAB1 and ITAB2 are matching .
    *--write your logic here
      ELSE.
    *--ITAB1 and ITAB2 records are not matching.
      ENDIF.
    ENDLOOP.
    Regards
    Srikanth
    Message was edited by: Srikanth Kidambi

  • How to find no of bytes per character in a word - Urgent need

    Hi,
    I have some data in the database with chinese characters. I want to know how many bytes per each character in a word and get the total bytes.
    Is there any built in Oracle function or anything where i can get no of bytes for each character or a word.
    I am not able to find the solution anywhere.
    Any help is appreciated.

    Hi,
    You can use LENGHTB function.
    SQL>SELECT LENGTHB(dummy) FROM DUAL;
    LENGTHB(DUMMY)
                 1
    1 row selected.
    SQL>Regards

  • Comparing two words in different lines

    hi frens, please help me.
    let say each line has 2 words
    <word1> <word2>
    what i am going to do is to compare the first word for each line. for example, let say this is the input file:
    hello world
    baby good
    hello baby
    good stuff
    hello good
    good job
    what i want for the output is:
    hello = world; baby; good
    baby = good
    good = stuff; job
    so it compares the prefix, if equals, then just print the second words behind. they are stored in hash table. thanks.

    Cross-posted,
    http://forum.java.sun.com/thread.jsp?forum=31&thread=411889&tstart=0&trange=15

  • PS CS6: how to create a left to right two-word-curved-headline gradient within the letters without having  to do each letter individually ?

    Q#1:
                I want to learn, how, with Photoshop and Illustrator to create a left to
    right two-word-curved-headline gradient within the letters without having
    to do each letter individually ???
    Q#2:

    https://www.google.com/search?sourceid=chrome-psyapi2&rlz=1C1CHFX_enUS546US546&ion=1&espv= &ie=UTF-8&q=Onlint%20Photoshop…

  • When searching two word sites (i.e.router bit)page 2 inserts special character(+) between words and stops search asking if I spelled incorectly

    When I'm on Firefox and enter search terms that have two words separated by a space such as "Harbor Freight" or "router bit"'if I advance to the second page a (+) sign is inserted between the words and the search stops and I'm asked to check my spelling. This does not happen if I am using Int.Expl.

    I followed your instructions and installed Developer Suite 10G on Windows Vista Home Premium edition. I have Oracle 11G DB running on the same machine.
    Two points, Steve:
    1. When I tried to set the maximum virtual memory to 6110 an error message displayed from Windows and told me that I can't set the maximum virtual memory to more than 4096. I set it to 4090 and it worked and I got nothing wrong during the installation process.
    2. After installing JInitiator and disabling Java on Firefox I called the http://127.0.0.1:8889/forms/frmservlet page and everything seemed to be OK because the Oracle Forms Services logo appeared and then a successful installation message appeared , but as I clicked (ok) to continue a gray screen appeared inside the browser (like the one displayed when you try to run a Java applet inside a browser) and then I wait to death till something appears but sadly nothing. I just get a blank gray screen inside my Firefox browser.
    Do you have any idea what to do to solve the problem?
    Regards

  • Common character in two Strings

    I am trying to write a method for a class that accepts two Strings from the user.
    The method should return the position of the first occurence of a character in the first word that is a common character in both words.
    I was thinking that maybe I would need to use the charAt() and indexOf() methods of the string class but I can not get this to work.
    Do i need to convert each string into a character array and then compare the values, or do i need to place them in a vector or was I on the right track before?
    please help as i'm getting a headache!

    Try this.
    int onePos = -1;
              int twoPos = -1;
              one = one.toUpperCase();
              two = two.toUpperCase();
              for (int a = 0; a < one.length(); a++) {
                   for (int b = 0; b < two.length(); b++) {
                        if (one.charAt(a) == two.charAt(b)) {
                             onePos = a;
                             twoPos = b;
                             a = one.length();
                             b = two.length();
              }

  • How do I add a two word phrase to index

    I’m trying to speed up the process of adding Latin names of plants and animals to an index using Indesign CS4. These consist of two word phrases (genus + species) which need to be put into the topic level 1 and topic level 2 boxes of the New Page Reference (Index) dialog. Using Ctrl 7 to invoke the dialog just puts whatever is selected into Topic1 and using Shift+Ctrl+Alt+] adds a ‘proper name’ index entry (Surname, forename) which is no good. When the information has been entered, a simple nested index can be produced, sorted by  genus and then species.
    I’m used to programming using vb in MS Office but am totally new to javascript and this has taken two days to get this far. The first problem is that if the user only puts an insertion point into the first word (genus) I can’t figure out how to move to the second word (species) in order to save it to a variable.
    So I have:
    var myTopic1 = "" ; // topic level 1, i.e. genus
    var myTopic2 = "" ; // topic level 2, i.e. species
    myIP = app.selection[0] ;
    myTopic1 = myIP.words[0].contents ;
    This works on a insertion point in any word, or if a phrase is highlighted will take the first word.
    Is there a simple way of copying the second word after the insertion point to myTopic2? I’ve tried various methods but can’t get anything to work. I thought it would be a simple matter of adding 1 to the index of the containing paragraph or story.
    I’ve got round this in a very long-winded way by asking the user to select the whole genus+species string, then working out the position of the dividing space and reconstructing the genus and species character by character:
    var myString = "" ; // user-selected string: genus + species
    myString = myIP.contents
    myStringlen = myIP.contents.length
    var xposn = myString.indexOf(" "); // gives posn of the (first) space character within selected string
    var yposn = 0 ; // start of the string
    myTopic1 = myString.charAt(yposn) ;
    while (yposn < (xposn-1))
    myTopic1 = myTopic1 + myString.charAt(yposn+1) ;
    yposn++ ;
    while (xposn < myStringlen)
    myTopic2 = myTopic2 + myString.charAt(xposn+1) ;
    xposn++ ;
    // show results:
    alert("Topic1 = " + myTopic1 + ". Topic 2 = " +myTopic2) ;
    So at this point I need to figure how to invoke the New Page Reference dialog with Topic1 and Topic 2 filled in? I would like the option of overriding the character format of the page reference ‘Number Style Override’, so would prefer to conclude the script with the dialog left open. Can this be done using script, or do I need a custom dialog? Alternatively it would also be good to just automatically save Topic1 and Topic2 and insert the index marker at the selection point without invoking any dialogs. I’m really struggling to get anywhere with this, can someone please help! Many thanks. Sorry for the long post.

    John,
    It can be confusing initially, but JavaScript and InDesign's object model will soon make sense. What you want to do can be done with this script:
    w1 = app.selection[0].words[0].contents;
    w2 = app.selection[0].words[1].contents;
    doc = app.activeDocument;
    if (doc.indexes.length == 0){
        doc.indexes.add();
    species = doc.indexes[0].topics.add (w1).topics.add (w2);
    species.pageReferences.add (app.selection[0], PageReferenceType.currentPage);
    Select genus and species, then run the script.
    It's not possible (I don't think) to open the New page Reference dialog. Do you want to apply the number style override to all page references? If that's the case, don't. Apply the character style to the page numbers after the index has been generated, or better, set it in the index paragraph style.
    If you want to apply the number style override only to some pages, you can do as follows. Before selecting genus+species, prefix the genus name with e.g. #. That symbol tells the script to add an override. The script will strip the #, create the page reference, and add the override. You need to tell the script somehow which character style to use for the override.
    Peter
    Edit: Jump beat me to it, and gives you a different method to get your two words. Spoilt for choice!
    P.

  • I have a few hundred duplicates in my iPhoto library, but the file sizes are different.  So one is 1.3mb and one is 567kb.  I want to delete the smaller ones, but short of comparing each duplicate, is there a way to do this?

    I have a few hundred duplicates in my iPhoto library, but the file sizes are different.  So one is 1.3mb and one is 567kb.  I want to delete the smaller ones, but short of comparing each duplicate, is there a way to do this?  I've been looking at Duplicate Annhilator but I don't think it can do it.
    Thanks!

    I just ran a test with iPhoto Library Manager, Duplicate Annihilator, iPhoto Duplicate Cleaner, Duplifinder and Photodedupo.  I imported a folder of 5 photos into a test library 3 times, allowing iPhoto to import duplicates.  I then ran the 5 photos thru resizer to reduce their jpeg compression but all other aspects of the file the same.
    None of the duplicate removal apps found set that was reduced in the file resizer. That's probably due to the fact that the file creation date was being used as a criteria and the resized photo would have a different file creation date even though the Image Capture date was the same.
    They all found the 3 regular duplicates and some of them would mark two and leave the 3rd unmarked.  iPhoto Duplicate Cleaner can sort the found duplicates by file size but if the file was edited to get the reduced file size it might not be found as it would have a different file creation/modification date. 
    iPhoto Library Manage was able to find all duplicates and mark them as such if the file names were the same the the filename option was selected.  Otherwise it also missed the modified, resized version.  It allowed one to select the one photo to save before going to work on the library.
    So if a photo has been reduced in image quality or pixel size it will not be considered a duplicate.
    OT

  • How can i compare the contents of two folders ?

    how can i compare the contents of two folders and find out which files are in one but not in the other?? Knowing how to do this would be the best thing ever, especially when dealing with a large number of files. Often, for instance, I'm dealing with a large number of images, processing them, and saving the retouched ones to a new folder, and need to check that they are all there. If there are say three files missing in the second folder (out of say a hundred in total) being able to automate the process of elimination would be very useful. Please help!!!
    B

    I really wish I knew the answer to this. I work between two macs, a G5 and MacBook Pro when I'm on the go. Each time I move from one to the other I have to copy all my files to the computer I'm going to work on, so I end up with the same files being duplicated. It's not a problem if it's not much data but in my case the it can be to 30GB, mostly graphics files, photoshop, motion, final cut pro, etc.
    There's has got to be a way automator can make a comparison between two folders to sort out what's changed and what's remained the same. It would be nice also if this feature could be done globally on the hard disk using spotlight's technology to stop files being duplicated in places you didn't even know about and taking up valuable disk space. I'm not sure how this could be done.
    Any bright ideas Apple?

  • How can I make my query to compare only columns of two tables... not the storage information?

    11GR2
    =-----------------------------------
    I am using below querry to compare two table that has same name, under two different users... But after making storage information false like below and  if the storage information is different on column level than it create "Alter modify " statements for the column ... How can I make my query to compare only columns of two tables... not the storage information?
    begin
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'PRETTY', TRUE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',TRUE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SEGMENT_ATTRIBUTES', FALSE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'STORAGE', FALSE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'TABLESPACE',FALSE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'CONSTRAINTS',FALSE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'REF_CONSTRAINTS',FALSE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'CONSTRAINTS_AS_ALTER',FALSE);
    End;
    select REGEXP_REPLACE(dbms_metadata_diff.compare_alter('TABLE','TABLE_NAME_A','TABLE_NAME_A','USER1','USER2'),('USER1...'),'', 1, 0, 'i') from dual

    I am using below querry to compare two table that has same name, under two different users... But after making storage information false like below and  if the storage information is different on column level than it create "Alter modify " statements for the column ... How can I make my query to compare only columns of two tables... not the storage information?
    If you want help you have to SHOW us what you are doing and how you are doing it; you can't just try to tell us in your own words.
    We can't see your computer screen.

  • How to select each character of column value

    Hi All,
    How can i get each character separately of a column value in a select statement.
    LIKE i emp table if ename='Test' then i want
    a select statement that can give me the result like this
    T,e,s,t
    Regards,
    Anil R

    or this?
    SQL> create table mytable
      2  as
      3  select 'test' text from dual union all
      4  select 'a text, containing two comma''s (,)' from dual union all
      5  select 'a text ending with a comma,' from dual
      6  /
    Tabel is aangemaakt.
    SQL> select text
      2       , substr(regexp_replace(text,'(*?)',',\1'),2,length(text)*2-1) with_commas
      3    from mytable
      4  /
    TEXT                               WITH_COMMAS
    test                               t,e,s,t
    a text, containing two comma's (,) a, ,t,e,x,t,,, ,c,o,n,t,a,i,n,i,n,g, ,t,w,o, ,c,o,m,m,a,',s, ,(,,,)
    a text ending with a comma,        a, ,t,e,x,t, ,e,n,d,i,n,g, ,w,i,t,h, ,a, ,c,o,m,m,a,,
    3 rijen zijn geselecteerd.Regards,
    Rob.
    Message was edited by:
    Rob van Wijk
    Slight modification to cater for strings beginning and ending with commas.

  • Extracting two words from the article in english

    i have an english article which is to be classified into a particular category based on the keywords. There are lacks of keywords stored in database. What i have to do is to obtain the keywords from the article and match it from the database. if match is found then the article belongs to that particular category. This keyword matching i did for one word by using split(" "), but now i want to do for 2 words from an article.that is getting 2 words from the article which is repeated many times.then searching it in the db.(here 2 words will be considered as one keyword)
    Now what i should do to get the two appropriate keywords from the article without taking a,am,the,is,when etc...(leaving many generic words).
    Any help will be appreciated.

    hi,
    thanks for reply!
    I know its a bad algorithm classify the article written in english only based on few words appearing in the article.
    But what i want to do is first extract the words from the article leaving the generic words, then count the single word each.Then i am sorting the words based on count and taking the five words from the article which has highest count. Now i have the database where millions of keywords are stored. These keywords are refering to particle category
    ie. if we consider a category as sports, then under this category i have many keywords stored in the database like cricket, football, worldcup,tennis... etc
    Now if i search the appropriate word from the article it will be considered as keyword. then this will be searched in the database. if match is found then it means the article belongs to sports category.
    Now problem is some times article can have two words which can be considered as one keyword and can be used to classify article in much better way.
    The question is how to get such words from the article???
    ex.. if Hero's Journey is combined word appearing many times in the article then this keyword can be used to classify the article much better than going for single word.
    Can anybody help me in this regard.
    Any help will be appreciated.

  • Aligning two words for logo in Illustrator

    Hello!
    I'm working on a logo right now, but here is the problem: I have two words that I'd like to have like this:
    APPLE
    PEAR
    But I would like to exactly align the two words at either ends, but I don't know how, because when I type in Illustrator, it puts the words underneath each other, but not 100% outlined/aligned.
    Appreciate your help, thanks!

    Bernard,
    You may select either/each of the word with the Type Tool and then adjust the Tracking in the Paragraph palette so that they fit.
    You may adjust either or both (in opposite ways) for least possible ugliness.

  • DW extension to make it first two WORDS bold

    dear experts,
    I have a db with one column - DESCRIPTION
    I would like to have the first two words of this column to be
    displayed in
    BOLD, how can I do that in DW
    I am sure there must be an extension for this
    please help
    thanks

    David Powers wrote:
    > Techy wrote:
    >> I have a db with one column - DESCRIPTION
    >>
    >> I would like to have the first two words of this
    column to be
    >> displayed in
    >> BOLD, how can I do that in DW
    >
    > When asking a question about databases, you should
    always say which
    > database and which server-side language you are using.
    The answer will
    > almost always be different for each one.
    >
    > I very much doubt that anyone has created a Dreamweaver
    extension to do
    > this. However, it should be relatively easily
    accomplished using
    > server-side string manipulation functions. Without
    knowing what you're
    > using, nobody can give you an answer.
    >
    sure, you can do that with :
    - server-side language like(PHP, ASP, JSP, CFM, Ruby, ...)
    - javascript
    here is javascript function
    function setBold(string){
    var pos = string.indexOf(" ");
    var pos2 = string.indexOf(" ",pos+1);
    var first = string.slice(0,pos2).bold();
    var last = string.slice(pos2);
    document.write(first+" "+last);
    setBold("salut c'est moi");
    you can do that (properly) with regexp

Maybe you are looking for