Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6806469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:42:52+00:00 2026-05-26T19:42:52+00:00

When executing the command == between 2 equal string’s I am getting the return

  • 0

When executing the command == between 2 equal string’s I am getting the return false.

The following code:

somewhere in the code:

Arr.prod.push({
                 "id" : product.id,
                 "nameProd" : product.name
    });

In other local at code:

var id;
for(i in Arr.prod){
   if( $.trim(str) == $.trim(Arr.prod[i].nameProd)){
        id = Arr.prod[i].id;
    break;
    }
}

when i = 3, the value of Array.prod[i].nameProd is equal of str value. The value of these variables is: “DVD Player Automotivo CED229X – Tela 3, Entrada USB Frontal, Entrada SD Flip Down e Controle Remoto – Philips – Philips – Americ …”. But the comparison always returns false.

What is wrong?

EDIT

adding code in for iteration:

console.log( 'str = ' + $.trim(str).toLowerCase(), ', item = ' + 
$.trim(Arr.prod[i].nameProd).toLowerCase(), 'result = ' + 
($.trim(str).toLowerCase() == $.trim(Arr.prod[i].nameProd).toLowerCase()));

RESULT

str = dvd player automotivo ced229x – tela 3”, entrada usb frontal,
entrada sd flip down e controle remot … , item = tv 46″ led full hd
(1920 x 1080 pixels) – 46pfl7606d/78 – smart tv ambilight spectra 2,
online tv, c … result = false

str = dvd player automotivo ced229x – tela 3”, entrada usb frontal,
entrada sd flip down e controle remot … , item = home theater c/ dvd
– 250 w rms, hdmi,divx, usb – hts3510/78 – philips – philips – americanas.com.br result = false

str = dvd player automotivo ced229x – tela 3”, entrada usb frontal,
entrada sd flip down e controle remot … , item = notebook hp result
= false

str = dvd player automotivo ced229x – tela 3”, entrada usb frontal,
entrada sd flip down e controle remot … , item = tenis rebook result
= false

str = dvd player automotivo ced229x – tela 3”, entrada usb frontal,
entrada sd flip down e controle remot … , item = dvd player
automotivo ced229x – tela 3”, entrada usb frontal, entrada sd flip
down e controle remot … result = false

The last comparison should be true

look this

console.log('str : ' + escape(str));
console.log('arr : ' + escape(Arr.prod[i].nameProd)));

RESULT:

str : DVD%20Player%20Automotivo%20CED229X%20-%20Tela%203%27%27%2C%20Entrada%20USB%20Frontal%2C%20Entrada%20SD%20Flip%20Down%20e%20Controle%20Remot%20...

arr : DVD%20Player%20Automotivo%20CED229X%20-%20Tela%203%27%27%2C%20Entrada%20USB%20Frontal%2C%20Entrada%20SD%20Flip%20Down%A0e%20Controle%20Remot%20...

look after “Down” word in 2 log’s:

In str contains %20e%, as in arr contains %A0e%.

What is happening?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:42:53+00:00Added an answer on May 26, 2026 at 7:42 pm

    For some reason you code is generating a non-breaking space (ascii 160 or A0) after the word “Down” thus the %A0.

    Why this happens i have no clue, but that is what you need to fix.

    If you cannot figure out how to fix this problem, then you can at least treat the symptom by replacing the non-breaking spaces with normal spaces before comparison, like this:

    $.trim(str).replace(/\xa0/g,' ') == $.trim(Arr.prod[i].nameProd.replace(/\xa0/g,' '))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

At a unix command line, what's the difference between executing a program by simply
In Bash I'm executing a command and putting the result in a variable like
I know that SqlContext.WindowsIdentity returns the current user that is executing the command (in
I have an awesome trouble with Gem. After executing this command: rm -f /usr/local/lib/ruby/gems/1.9.1/cache/*
I am executing a diff command in perl . my @lines = `/usr/local/bin/diff -udr
I cannot get the example Python programs to run. When executing the Python command
Below is the command I tried executing, without success: exec('ln -s ' . PLUGIN_DIR
Say I have a command line C program which is currently executing, and I
I'm tearing my hair out trying to work out why the command I'm executing
I need something like make i.e. dependencies + executing shell commands where failing command

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.