4 Replies - 6669 Views - Last Post: 29 July 2012 - 11:30 AM Rate Topic: -----

#1 Feuer   User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 57
  • Joined: 15-June 11

String equality

Posted 29 July 2012 - 08:44 AM

Now I am really missing something here. I read key=val - lines from file, parse the keys and values, and check if key=="Bold". It seems though that "Bold" != "Bold". Why is that?

mod edit: including image
Posted Image

This post has been edited by Curtis Rutland: 30 July 2012 - 07:45 AM
Reason for edit:: including image


Is This A Good Question/Topic? 0
  • +

Replies To: String equality

#2 [email protected]   User is offline

  • D.I.C Addict
  • member icon

Reputation: 1003
  • View blog
  • Posts: 975
  • Joined: 30-September 10

Re: String equality

Posted 29 July 2012 - 08:50 AM

Looks like there is a whitespace character at the end of the "Bold" referenced by the key variable.

"Bold "

should be

"Bold"

The String.TrimXXX() methods at the bottom of the "Methods" section here might be of use.

:)

This post has been edited by [email protected]: 29 July 2012 - 08:55 AM

Was This Post Helpful? 2
  • +
  • -

#3 Feuer   User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 57
  • Joined: 15-June 11

Re: String equality

Posted 29 July 2012 - 11:24 AM

Damnation, I knew I was missing something. I got the "Bold" == "Bold" yielding correct value, now I only have to revert back to the dictionary-implementation, which I overwrote thinking the problem was with the way I used the dictionary. Thank you :)
Was This Post Helpful? 0
  • +
  • -

#4 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 7192
  • View blog
  • Posts: 24,375
  • Joined: 05-May 12

Re: String equality

Posted 29 July 2012 - 11:27 AM

Source control is your friend. Pick one: Mercurial, Git, Subversion, Perforce, TFS, etc. Heck, make .zip backups if you need to. I wouldn't wish Visual SourceSafe on anybody, though.
Was This Post Helpful? 0
  • +
  • -

#5 Feuer   User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 57
  • Joined: 15-June 11

Re: String equality

Posted 29 July 2012 - 11:30 AM

Oh yes, I have used Mercurial here and there, but I thought this project so "experimental" and "small", that I wouldn't need to use it. A common mistake, I know.

I have used Sourcesafe in the work, and know what you mean. It's better than nothing, but I'd take Mercurial over it anyday.

This post has been edited by Feuer: 29 July 2012 - 11:31 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1