0
Is there a way to convert a linked list to a string?
I have a linkedlist of sentences and another linkedlist of words. I want to check the sentences linkedlist for the words in the words linkedlist and was thinking a good approach would be to convert the words linked list to a string.
6 odpowiedzi
+ 11
Isang-Ofon Udo-Arthur ,
it would be helpful if can mention the programming language and also show us your attempt.
thanks!
+ 6
Isang-Ofon Udo-Arthur , [edited]
you can do this with 2 nested loops. use the outer loop to iterate through the sentences, and the inner loop to iterate through the words.
so you are able to check if a word is a substring of a sentence.
+ 6
Isang-Ofon Udo-Arthur ,
we can create a string from a list by using: (e.g from the word list)
....
string newStr = string.Join( " ", word); // instead of using " " as a separator for the new string, we can use other separators like "," ...
Console.WriteLine(newStr);
....
+ 1
Sorry about that. In C#
0
C#
Is there a way to convert a linked list to a string?
I have a linkedlist of sentences and another linkedlist of words.
I want to check the sentences linkedlist for the words in the words linkedlist and was thinking a good approach would be to convert the words linked list to a string.
0
Thanks. I will look at that approach.
But I'll still like to know if there's way changed a linkedlist to a single string