2 Replies - 549 Views - Last Post: 07 September 2009 - 07:44 AM Rate Topic: -----

#1 kunkka  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 99
  • Joined: 15-May 09

Comparing 2 Strings with Substring in C++ ( HELP NEEDED)

Posted 07 September 2009 - 06:44 AM

hi,

i want to compare two strings. one is from a string array(A). other one is from a string( B ) i want to check whether the ( B ) is existing a part of the ( B ) in (A). so those parts can show as the results. i have done the string comparison using strcmp. but i want to get several outputs. as example given below


lets say the saerching name is : naval

if the (A) string array have a similar names like nash, value , aval .. those results should come without just comparing as strcmp. which shows only one record.

please help me ( btw im not asking the code. im asking is there way and then which are the methods as strcmp to compare two strings)

*** MOD EDIT: Made readable by removing smilies ***

This post has been edited by JackOfAllTrades: 07 September 2009 - 07:00 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Comparing 2 Strings with Substring in C++ ( HELP NEEDED)

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6063
  • View blog
  • Posts: 23,514
  • Joined: 23-August 08

Re: Comparing 2 Strings with Substring in C++ ( HELP NEEDED)

Posted 07 September 2009 - 07:01 AM

I this is a std::string, why not use find()?
Was This Post Helpful? 0
  • +
  • -

#3 kunkka  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 99
  • Joined: 15-May 09

Re: Comparing 2 Strings with Substring in C++ ( HELP NEEDED)

Posted 07 September 2009 - 07:44 AM

find().. wait let me check ti
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1