How to find a word from a sentence with stringfind?

Back to topics list To post a new topic, please log in or register
avatar
160
cashcube 2016.03.06 09:56
 

Hi 

I have an indicator which reads from a csv file. Now after fetching the data it stored in Description which is a string data type.

On Description data are stored in following manners: 

"Apple Fruit"

"Potato Vegetables" 

Using stringfind I want to fetch only Fruit.

I am doing this:

int comp = StringFind(Description,"Fruit",0);

 But it returns comp = -1 all the time. Even if there is a data similar to fruit available on the csv file.

 Please help how to do this.

Thank you in advance. 

avatar
2017
gooly 2016.03.06 09:58 #
 
Provide the full code to get help!
avatar
108
eddie 2016.03.06 10:11 #
 

You can be shure that StringFind works correct.

Maybe there is a "fruit" in Description and no "Fruit" ?

You have to check each line of the csv-file seperately.

avatar
Moderator
3423
GumRai 2016.03.06 10:18 #
 
Do a small test and Print Description before using StringFind to make sure that "Fruit" is in the string variable
avatar
160
cashcube 2016.03.06 10:24 #
 

Thank you everybody for such a quick reply. Actually I figure, its happening because of the space. If I search for Apple then its not problem. But if I search for Fruit, then it creates problem. In case of stringfind I need to give start point, I use 0 as start point. But as soon it hit space, I guess it stopped there. 

So I need to find where the space is located. So that In stringfind I can search after the space.

Any idea?

Thank you again. 

avatar
108
eddie 2016.03.06 10:30 #
 

A space is no problem for StringFind!

Check what's in Description.

avatar
160
cashcube 2016.03.06 10:35 #
 
eddie:

A space is no problem for StringFind!

Check what's in Description.

Yes checked it out. 
I am extremely sorry, I made a silly mistake, space is not a problem. 

Search type spelling was wrong.

I Solved it now.. Thank you again..

Have a nice day... everybody... 

Back to topics list  

To add comments, please log in or register