search and replace strings with lists 
Author Message
 search and replace strings with lists

hi everyone!!

i have just started learning see
and have a problem

i need to search for a string in a file that i have changed to a
linked list and then replace it with another string

i have converted the string i need to look for into a list as well
but i don't know how to compare them use strcmp but i am actually
comparing chars

help me restore my smile
thanx in advance



Mon, 11 Apr 2005 10:53:25 GMT  
 search and replace strings with lists

Quote:

> hi everyone!!

> i have just started learning see
> and have a problem

> i need to search for a string in a file that i have changed to a
> linked list and then replace it with another string

Linked list of what? Words? Characters?

Quote:

> i have converted the string i need to look for into a list as well
> but i don't know how to compare them use strcmp but i am actually
> comparing chars

The string comparison function is (funny enough) intended to
compare strings. Linked lists of characters don't qualify.
You'll probably need you write your own comparison function,
and then call it on the current node of the list whenever
head(file_list) == head(search_list).

--
   Good engineering is simply finding the
right wrench to pound in the correct{*filter*}



Mon, 11 Apr 2005 11:06:50 GMT  
 search and replace strings with lists
KMP is a good method to do it.

Quote:

> > hi everyone!!

> > i have just started learning see
> > and have a problem

> > i need to search for a string in a file that i have changed to a
> > linked list and then replace it with another string

> Linked list of what? Words? Characters?

> > i have converted the string i need to look for into a list as well
> > but i don't know how to compare them use strcmp but i am actually
> > comparing chars

> The string comparison function is (funny enough) intended to
> compare strings. Linked lists of characters don't qualify.
> You'll probably need you write your own comparison function,
> and then call it on the current node of the list whenever
> head(file_list) == head(search_list).

> --
>    Good engineering is simply finding the
> right wrench to pound in the correct{*filter*}



Mon, 11 Apr 2005 20:12:31 GMT  
 search and replace strings with lists


Quote:
>   Good engineering is simply finding the
>right wrench to pound in the correct{*filter*}

I don't have anything to add about strings or lists; I just wanted
to mention that I read the above sig as "wench" at first....

--Ben (*you* certainly don't look like a nail, dollink)

--



Tue, 12 Apr 2005 04:30:36 GMT  
 search and replace strings with lists


Quote:
>hi everyone!!

>i have just started learning see
>and have a problem

>i need to search for a string in a file that i have changed to a
>linked list and then replace it with another string

>i have converted the string i need to look for into a list as well
>but i don't know how to compare them use strcmp but i am actually
>comparing chars

>help me restore my smile
>thanx in advance

Read a portion of the file into a buffer.  Use strstr to determine if
the string of interest is present.  If not repeat until either you
find the string or you detect end of file.

<<Remove the del for email>>



Tue, 12 Apr 2005 09:17:55 GMT  
 search and replace strings with lists
in comp.lang.c i read:

Quote:


>>i need to search for a string in a file that i have changed to a
>>linked list and then replace it with another string

>>i have converted the string i need to look for into a list as well
>>but i don't know how to compare them use strcmp but i am actually
>>comparing chars
>Read a portion of the file into a buffer.  Use strstr to determine if
>the string of interest is present.  If not repeat until either you
>find the string or you detect end of file.

being careful of the boundary case.

--
bringing you boring signatures for 17 years



Tue, 12 Apr 2005 10:25:18 GMT  
 search and replace strings with lists

[top-post corrected]

Quote:



>> > hi everyone!!

>> > i have just started learning see
>> > and have a problem

>> > i need to search for a string in a file that i have changed to
>> > a linked list and then replace it with another string

>> Linked list of what? Words? Characters?

>> > i have converted the string i need to look for into a list as
>> > well but i don't know how to compare them use strcmp but i am
>> > actually comparing chars

>> The string comparison function is (funny enough) intended to
>> compare strings. Linked lists of characters don't qualify.
>> You'll probably need you write your own comparison function,
>> and then call it on the current node of the list whenever
>> head(file_list) == head(search_list).

> KMP is a good method to do it.

Excuse my ignorance, but KMP would be...? I tried Google and
AcronymFinder, but nothing so far seems really appropriate.

  Keep Me Posted?
  Key Management Protocol?
  Kilusang Magbubukid ng Pilipinas?
  Kangaroo Management Program?

--

Stockholm, Sweden



Tue, 12 Apr 2005 17:43:55 GMT  
 search and replace strings with lists
thanx for the help but i really neeed to use lists or can i read
characters from a list into a buffer???
gosh!!! am i confused???
a desperate call for HELP!!!!!
Quote:



> >hi everyone!!

> >i have just started learning see
> >and have a problem

> >i need to search for a string in a file that i have changed to a
> >linked list and then replace it with another string

> >i have converted the string i need to look for into a list as well
> >but i don't know how to compare them use strcmp but i am actually
> >comparing chars

> >help me restore my smile
> >thanx in advance

> Read a portion of the file into a buffer.  Use strstr to determine if
> the string of interest is present.  If not repeat until either you
> find the string or you detect end of file.

> <<Remove the del for email>>



Tue, 12 Apr 2005 20:07:11 GMT  
 search and replace strings with lists

Quote:


> [top-post corrected]



> >> > i have just started learning see
> >> > and have a problem

> >> > i need to search for a string in a file that i have changed to
> >> > a linked list and then replace it with another string

> >> Linked list of what? Words? Characters?

> >> > i have converted the string i need to look for into a list as
> >> > well but i don't know how to compare them use strcmp but i am
> >> > actually comparing chars

> >> The string comparison function is (funny enough) intended to
> >> compare strings. Linked lists of characters don't qualify.
> >> You'll probably need you write your own comparison function,
> >> and then call it on the current node of the list whenever
> >> head(file_list) == head(search_list).

> > KMP is a good method to do it.

> Excuse my ignorance, but KMP would be...? I tried Google and
> AcronymFinder, but nothing so far seems really appropriate.

>   Keep Me Posted?
>   Key Management Protocol?
>   Kilusang Magbubukid ng Pilipinas?
>   Kangaroo Management Program?

He is being extremely obscure, but I believe he is thinking of the
Knuth-Moyer-Pratt algorithm for string matching.  Or is that
Knuth-Morris-Pratt?  Details in Sedgewicks "Algorithms", among
other places.

--

   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!



Tue, 12 Apr 2005 21:22:33 GMT  
 search and replace strings with lists

<snip>

Quote:
> He is being extremely obscure, but I believe he is thinking of the
> Knuth-Moyer-Pratt algorithm for string matching.  Or is that
> Knuth-Morris-Pratt?  Details in Sedgewicks "Algorithms", among
> other places.

Knuth-Morris-Pratt it is. The former algorithm is perhaps what you get
when you mix it with Boyer-Moore :-)

--

Stockholm, Sweden



Tue, 12 Apr 2005 23:38:55 GMT  
 search and replace strings with lists
On 25 Oct 2002 02:25:18 GMT, those who know me have no need of my name

Quote:

>in comp.lang.c i read:


>>>i need to search for a string in a file that i have changed to a
>>>linked list and then replace it with another string

>>>i have converted the string i need to look for into a list as well
>>>but i don't know how to compare them use strcmp but i am actually
>>>comparing chars

>>Read a portion of the file into a buffer.  Use strstr to determine if
>>the string of interest is present.  If not repeat until either you
>>find the string or you detect end of file.

>being careful of the boundary case.

No he didn't.  I did that.  Your comment is correct however.

<<Remove the del for email>>



Wed, 13 Apr 2005 12:50:24 GMT  
 search and replace strings with lists


Quote:



>> >hi everyone!!

>> >i have just started learning see
>> >and have a problem

>> >i need to search for a string in a file that i have changed to a
>> >linked list and then replace it with another string

>> >i have converted the string i need to look for into a list as well
>> >but i don't know how to compare them use strcmp but i am actually
>> >comparing chars

>> >help me restore my smile
>> >thanx in advance

>> Read a portion of the file into a buffer.  Use strstr to determine if
>> the string of interest is present.  If not repeat until either you
>> find the string or you detect end of file.

>> <<Remove the del for email>>
>thanx for the help but i really neeed to use lists or can i read
>characters from a list into a buffer???
>gosh!!! am i confused???
>a desperate call for HELP!!!!!

Please don't top post.  I rearranged your response.

What do you mean you have converted a file to a list?  What kind of
list?  What are the elements?

Obviously we need more detail to help.

<<Remove the del for email>>



Wed, 13 Apr 2005 12:50:26 GMT  
 
 [ 12 post ] 

 Relevant Pages 

1. Newbie: Sub-String search and replace routine

2. Newbie: Sub-String search and replace routine

3. String - search and replace

4. String : Search & Replace

5. string search & replace

6. String Search & Replace

7. search and replace in a string

8. String Search And Replace

9. Replace more then one charaster using String.Replace()

10. replacing string in string

11. Search and Replace facility

12. Optimization problem search and replace

 

 
Powered by phpBB® Forum Software