How to compare two strings whether both are equal while ignoring the difference in special characters (example: & vs & and many others)?

I attempted to compare two strings whether they are equal or not. They should return true if both are equal.
One string is based on Taxonomy's Term (i.e. Term.Name) whereas other string is based on String object.
The problem is that both strings which seem equal return false instead of true. Both string values have different special characters though their special characters are & and &
Snapshot of different design & same symbols:
Is it due to different culture or language?
How to compare two strings whether both are equal while ignoring the difference in special characters (& vs &)?

Hi Jerioon,
If you have a list of possible ambiguous characters the job is going to be easy and if (& vs &) are the only charracters in concern awesome.
You can use the below solution.
Before comparing pass the variables through a replace function to standarize the char set.
$Var = Replace($Var,"&","&")
This is going to make sure you don't end up with ambiguous characters failing the comparison and all the char are "&" in this case.
Similar technique is used to ignore Character Cases 'a' vs. 'A'
Regards,
Satyajit
Please “Vote As Helpful”
if you find my contribution useful or “Mark As Answer” if it does answer your question. That will encourage me - and others - to take time out to help you.

Similar Messages

  • How to Compare two strings in PL/SQL

    Hi All,
    I need to compare two strings whether they are equal or not in PL/SQL.Is there any function to comparing the strings.

    Yes, the = sign.
    Are you after something like:
    IF v_string1 = v_string2 THEN
    ELSE
    END IF;?
    Edited by: Boneist on 27-Aug-2009 11:41

  • Can I use Facetime between two devices which both are signed in to the same Apple ID?

    Can I use Facetime to communicate between two Apple devices which are each signed into the same Apple ID?

    Chris CA wrote:
    Phil0124 wrote:
    Yes.
    No.
    And use the new address to call that device.
    What new address?
    Perhaps you mean the OP needs to add a new email address for his AppleID and use that email address.
    Yes. That's what I meant.
    Change the "You can de Reached by Facetime At" for one of them under Settings->Facetime->You can be Reached by Facetimer At.
    I probably should have specified "Change the "You can de Reached by Facetime At"(email address) ...
    NOW TO CORRECT:  Even though I said you could, you can't.
    I tried this out just now and you can't facetime a device using the same Apple ID.
    So yes, you infact need another Apple ID for this. Not just another email address.
    My Bad. sorry.  I don't deserve the 10 points.

  • How to compare two strings with each other?

    Hello,
    I have modeled a formular which has a radio group and a button. Furthermore, I have one result state corresponding to each option in the radio group.
    In order to determine which result state actually is to be reached I want to attach a condition to each flow to the result states that tests which option has been chosen.
    Which operator can I use for writing these conditions? I have tried the "like" operator as well as the "==" operator but neither seems to work.
    I have written something like:
    =LIKE(@decision, 'option a')
    as well as:
    =(@decision=='option a')
    What am I doing wrong here?
    Thank you very much
    Alexander

    Hi Alexander,
    Could this be an Upper/Lower case issue.
    I tried the following expression
    =(@TXT1=="opt a")
    and it worked.
    If you want your expression to ignore case you should use this expression:
    =(UPPER(@TXT1)==UPPER("opt a"))
    In case you're not sure what is the exact string in the field (@decision) you can always use the PROMPT action to display the field's value.
    Regards,
    Udi

  • How to compare two dates that should not exceed morethan 3 years

    hi all,
    can you please tell me how to compare two dates( basically dates are string type)
    that should not exceed more than 3 years? in JAVASCRIPT
    Thanks in Advance.

    This is not a JavaScript forum.
    [*Google* JavaScript Forum|http://www.google.co.uk/search?q=JavaScript+Forum&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a]
    Good luck.

  • How to Compare Two Strng without .equals() method

    Hiii,
    How to compare two Strings with out .equals method if there are white spaces in between these string it should be avoided..
    eg: ab cd ef g is equal to a bc de fg
    Please give me the logic or code..
    Your help will be appreciated

    dude find the code without the equal method
    public class test {     
         public static void main(String args[])
              String str = "ab cd ef g" ;
              String str1 = "a bc de fg";
              char []ch = str.toCharArray();
              char []ch1 = str1.toCharArray();
              int counter =0, counter1 = 0;
              while(counter < ch.length && counter1 < ch1.length)
                   while(ch[counter]==' ')
                        counter++;
                   while(ch1[counter1]==' ')
                        counter1++;
                   if(ch[counter] != ch1[counter1])
                        break;
                   counter++; counter1++;
              if(counter == ch.length && counter1 == ch1.length)
                   System.out.println("true");
              else
                   System.out.println("false");
    }

  • HT4262 I have two networks one each in two cities.  Both are named the same but require different passwords. I am at my second location but cannot connect to his wifi network. How do I delet one network so I can connect to my second network?

    I have two networks one each in two cities.  Both are named the same but require different passwords. I am at my second location and cannot connect to this wifi network. How do I delet one network so I can connect to my second network?

    Just go to the wireless network preferences and empty out all the stored wireless networks.. then scan and connect to the local wireless.
    Select them and tap the - button below it.
    Once they are emptied out.. it might be good to reboot the computer with the remember networks unchecked.
    Start with a clean slate.

  • How to Compare Two Depreciation Area

    Is there some transaction to compare two depreciation areas in Asset Accouting? Or what else is the way to do that?

    Hi!
    Are you talking about the "Depreciation Comparison" report ? Program Name : RABIKA01.

  • ??how to compare two resultsets??

    hi all!
    i need to find out whether two resultsets contain the same data.
    the only way i know how to do it in java is to put them into a while loop and fetch the contents first and then compare the contents.
    but is there an easier way to compare resultsets?
    does anyone know how to compare two resultsets without extracting the data?
    the code example here executes two identical queries on an oracle database, compare and print the resultsets.
    public ResultSet getResultset(String query)
    ResultSet rs=null;
    try { rs=Stmt.executeQuery(query); }
    catch(Exception e) { e.printStackTrace(); }
    return rs;
    public static void main(String[] args) {
    ResultSet r1=null;
    ResultSet r2=null;
    try {
    database db = new ddatabase();
    r1=db.getResultset("Select 'name' from person");
    r2=db.getResultset("Select 'name' from person");
    if (r1 == r2) {
    System.out.println("ok");
    System.out.print(r1);
    System.out.println();
    System.out.print(r2);
    else {
    System.out.println("not ok");
    System.out.print(r1);
    System.out.println();
    System.out.print(r2);
    jdbc.cleanup();
    catch(Exception e) {e.printStackTrace();}
    and here is the output:
    F:\java rs_compare
    not ok
    oracle.jdbc.driver.OracleResultSetImpl@4413ee
    oracle.jdbc.driver.OracleResultSetImpl@786e64
    as you can see the resultsets are different though the data they contain have to be the same.
    so the 'if(resultset#1 == resultset#2)' does not work.
    thanks for any help
    best regards
    5ithl0rd

    Don't cross-post.
    I'll bet ResultSet implementations don't override equals() to provide "deep equals" behavior, in which case it'll be no different than using "==".
    It's a bad idea to compare two ResultSets this way. You'll have to load both into objects or data structures and compare those in a "deep" way.
    Besides, the ONLY way two ResultSets could be different, given the same query, would be if there were multiple clients that could write to the table between queries and change the underlying data. If your two queries are sufficiently isolated, I'd say that the same query will return the same ResultSet.
    %

  • How to compare two excel files in java ?

    how do i compare two excel files in java.?
    I have two excel files stored on my computer in d: drive.
    Ex:
    D:\\file a
    D:\\file b
    How to compare the contents of these two files and print " files are equal " or "files not equal "

    Javamastermahe wrote:
    I mean i want to print on the console "files are equal " or any message like " both the files match "If this is your requirement, this program satisfies it...
    import java.util.Random;
    public class SuperExcelTester {
        public static void main(String[] args) {
            Random rnd = new Random();
            String[] messages = {
                "files are equal",
                "files are not equal",
                "unexpected error"
            int index = rnd.nextInt(messages.length);
            System.out.println(messages[index]);
    }

  • How to compare two Objects !!!!

    Hi All,
    I know that this question has been asked 100 times till now. But trust me I have checked all of them but couldn`t find answer. Here is my question:
    I have an objecs. In that object I am setting (Id,Name,DOJ). Now I want to check whether the object I am trying to save in database already exists or not. If exists then I need to check whether all the setters are same for the two objects. Now can anyone tell me ,how to compare two objects directly without comparing the setters individually.
    Thanks in advance.

    pavan13 wrote:
    That is pretty good idea. However I have a query. Does that code actually compare all the setters in a two beans. I don`t want to check each setter seperately.Well, it's pretty meaningless to talk about "comparing setters", setters are methods, they don't have values to compare. Because equals is inside the class, you can simply compare the fields that get set by the setters. "Properties" is probably a better name.
    In principal you could write something that tried to find all relevant fields and compare them, using reflection or bean info stuff. The resulting code would be about 50 times longer and take about 50 times longer to run. It's hardly asking a lot to put three comparisons between && operators.
    Remember, though, not to compare string fields with ==, you should call .equals on the string fields.
    p.s. don't let the bean terminology confuse you. Beans are just ordinary objects which follow a few rules. Personally I wish the term had never been coined.
    Edited by: malcolmmc on Dec 6, 2007 4:15 PM

  • Compare two string in different line in textarea

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class TextCounterPanel extends JPanel {
    private JTextArea textInput;
    private JLabel lineCountLabel;
                        public TextCounterPanel() {
                        setBackground(Color.DARK_GRAY);
                        textInput = new JTextArea();
                        textInput.setBackground(Color.WHITE);
                        JPanel south = new JPanel();
                        south.setBackground(Color.DARK_GRAY);
                        south.setLayout( new GridLayout(4,1,2,2) );
                             JButton countButton = new JButton("Process the Text");
                             countButton.addActionListener( new ActionListener() {
                                  public void actionPerformed(ActionEvent evt) {
                                       processInput();
                             south.add(countButton);
                        lineCountLabel = new JLabel(" Number of lines:");
                        lineCountLabel.setBackground(Color.WHITE);
                        lineCountLabel.setForeground(Color.BLUE);
                        lineCountLabel.setOpaque(true);
                        south.add(lineCountLabel);
                        setLayout( new BorderLayout(2,2) );
                        setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY));
                        JScrollPane scroller = new JScrollPane( textInput );
                        add(scroller, BorderLayout.CENTER);
                        add(south, BorderLayout.SOUTH);
    public void processInput() {
    String text,vin; // The user's input from the text area.
    text = textInput.getText();
    vin =text.substring(25,42);
    lineCountLabel.setText(" vin: " + vin);
    } // end class TextCounterPanel
    How can I compare two string in different line in text area

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class TextCounterPanel extends JPanel {
    private JTextArea textInput;
    private JLabel lineCountLabel;
    public TextCounterPanel() {
    setBackground(Color.DARK_GRAY);
    textInput = new JTextArea();
    textInput.setBackground(Color.WHITE);
    JPanel south = new JPanel();
    south.setBackground(Color.DARK_GRAY);
    south.setLayout( new GridLayout(4,1,2,2) );
    JButton countButton = new JButton("Process the Text");
    countButton.addActionListener( new ActionListener() {
    public void actionPerformed(ActionEvent evt) {
    processInput();
    south.add(countButton);
    lineCountLabel = new JLabel(" Number of lines:");
    lineCountLabel.setBackground(Color.WHITE);
    lineCountLabel.setForeground(Color.BLUE);
    lineCountLabel.setOpaque(true);
    south.add(lineCountLabel);
    setLayout( new BorderLayout(2,2) );
    setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY));
    JScrollPane scroller = new JScrollPane( textInput );
    add(scroller, BorderLayout.CENTER);
    add(south, BorderLayout.SOUTH);
    public void processInput() {
    String text,vin; // The user's input from the text area.
    text = textInput.getText();
    vin =text.substring(25,42);
    lineCountLabel.setText(" vin: " + vin);
    } // end class TextCounterPanel

  • How to compare two elements?

    Hi Brothers,
    How can I compare two nodelements from different nodes if they have the same content?
    I tried
    boolean elementExists(IE_CustomerElement element){
           for (int i=0; i < wdContext.nodeChangedCustomerRows().size(); i++){
                if(element.equals(wdContext.nodeChangedCustomerRows().
                                    currentChangedCustomerRowsElement())){
                     return true;
           return false;
    But this doesn't work since element may be from a different node and thus is not equal to wdContext.nodeChangedCustomerRows().currentChangedCustomerRowsElement()
    Both elements have the same attributes, though...
    Any ideas? Thanks, Johannes

    Johannes,
    Object.equals method returns true only if both the arguments point to same object. So,
    element.equals(wdContext.nodeChangedCustomerRows().currentChangedCustomerRowsElement()
    will be true only if both element and nodeChangedCustomerRows().currentChangedCustomerRowsElement() refer to same object, which is not the case here.
    You'll need to do attribute comparison to see if the elements are equal. Something like this might work for you.
    boolean elementExists(IE_CustomerElement element)
           for (int i=0; i < wdContext.nodeChangedCustomerRows().size(); i++)
                if((element.Attribute1.equalsIgnoreCase(wdContext.nodeChangedCustomerRows().currentChangedCustomerRowsElement().Attribute1))&&
                   (element.Attribute2.equalsIgnoreCase(wdContext.nodeChangedCustomerRows().currentChangedCustomerRowsElement().Attribute2))&&
                   (element.Attribute3.equalsIgnoreCase(wdContext.nodeChangedCustomerRows().currentChangedCustomerRowsElement().Attribute3))
                          & so on....
                     return true;
           return false;
    There might be better ways to do this, let me know if you come across one.
    Hope this helps.
    Vishwas.

  • How to compare two different environments

    Can any please tell me how to compare two environments like DEVL to TEST?
    I know how to compare a project(like DEVL to TEST) but i want to see all the changes in all the objects between two different environments.
    Please help me.
    Thank you.

    That is really a good piece of information.
    Does it really matter where we are comparing from?
    i will explain,let us say we have DEV and TST environment.
    let us say both has same project name and the same number of objects but inside the object they may be different(like number of fields in the same record in both environments).
    Now we want to have a compare report between those environments.
    We can do in two different ways, right?
    (1. source DEV, Target TST)
    (2. source TST, Target DEV)
    will the result get changed in both the cases?
    (except like following)
    (first case souce target)
    ( absent *changed)
    (second case would be like following)
    ( souce target)
    ( *changed  absent)
    (but i gess the number of rows in both the cases does not get changed)
    let me know if you can not understand the question. sorry about the confusing explanation

  • How to compare two IDocs

    Hi all,
          How to compare two IDoc's. If the both the IDocs are are of same type, i want to distinguish the data in those two IDocs.
    Thank you in Advance
    Regards
    Harsha

    Hi Harsha,
    Transaction WE05 will help you out.You should first know some details like the
    iDoc type, partner, the date/time and maybe the iDoc #. There can be many iDocs
    generated/processed per day and without having some info to start with,
    one will never find anything useful. Filter what you can, and then
    navigate in the left hand frame/double click on the results lines in the
    right hand frame to drill down. Eventually you will see the single iDoc
    with all the many 'segments' available. Expand the 'data records'
    branch (and sub-branches) to see each 'segment' and find the data fields
    & values (these will appear in the lower right hand frame).
    Reward points if helpful..
    Regards,
    Goutham.

Maybe you are looking for

  • Scanning Multiple pages to single document Envy 5530

    Just bought this unit and would like to scan many pages into a single document, ideally sending it to an email, and/or to the desktop. I'm using Mac OS-X 10.8.5 with the Envy 5530. Thank you.

  • I can't open a project in Adobe Premiere CS6

    After suddenly closed the program i can't open again that project, every time i try appears this window: "Premiere Pro has encountered an error" [/Volumes/BuildDisk/builds/mightykilt/shared/adobe/dvamediatypes/project/mac/../../src/Tic kTime.cpp-207]

  • CE Bank Statement Load and Import Concurrent Request

    Hi All, I am trying to submit a concurrent request via PL/SQL for CE Bank Statement Loader but request_id always returns 0.. Being new to here i somehow cannot understand why so as I've tried this with GL's SQLLDR for the Journal Import. Here's a par

  • How to call java function through Web Service

    Hello Experts, I want to call a method through Java Web Service in my abap code. Is it possible ? If so, plz guide me. Requirement: In SD module user enters the PAN, on after entering PAN in want to validate it on NSDL. For that a Web Service has alr

  • Error With Snapshots

    Hiii.. Im having a oracle apps 11.5.10.2 and Database 10.2.0.4 on a Windows 2003 server. When i try to run awrrpt.sql  it is not showing any snapshots for the day, i think automatic snapshots are not getting created. The following is the scrshot when