Events to filter duplicate words and count the number of words containing the character "A"?

0 favourites
  • 11 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • Can anyone provide me the event sheet code for

    1.Filtering duplicate words(Of a String variable)

    2.Counting the number of words containing the letter "A"(By using a numeric variable)

  • 1. Loop through all words in the string with tokencount/tokenat (I hope you already know how to do it).

    Add each word to an array. Before adding check if this array already contains this word. If it does - increase the duplicate word counter and don't add the word into the array.

    2. Again, loop through words and use find(word,"a")>=0 expression to check if the word contains letter "a"

  • dop2000 can you create the project file and post a link to it on the forum as When I try to implement your code I get incorrect information of the character count because of my bugs,Can you please help me with this as this project will help me and its other potential users to reduce their spelling mistakes in the hindi language.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You keep asking very similar questions and never post your projects. Searching for words containing letter "a" is not much different from what you asked here.

    You need to show what have you tried, and we'll tell you how to fix it.

  • Well, dop2000 ,I am posting my project in a few minutes,Cbeers.

  • Edit-Removed the word "a" from this post because of a mistake.

    dop2000 ,This project is one of my a

    ttempts and In this project I get the the number of "A"'s in tge "Number of Character Matches" variable instead of the number of words which contain the word "A" in that variable and the project which was the result of my first attempt is here https://www.dropbox.com/s/f54wojbmzujbugr/Search%20and%20Analyzse%20WITH%20CHANGES.c3p?dl=0 ,And I will post the project of my second attempt soon,Cheers.

  • Did you post the correct file? I have no idea what's going on in your code. I don't see the list of words in a string variable, I don't see your attempt to loop through these words and search for the letter "A".

  • Variable text="your list of words here"
    Variable counter=0
    
    Repeat tokencount(text, " ")-1 times
    	if find(tokenat(text, loopindex, " "), "a")>=0
    		Add 1 to counter
    
    
  • Yes,I have posted the correct file and you need fill the field "Name of List" and then the "Add words field" and then click the Ok button and you need to do all this in the debug mode after which a new list will be created(Note this list does not work) and you may optionally type a number in the "Number of words" list and after typing some words which contain the letter "A" in the "Search" list you will get an output which will tell you the number of matches between your text query and the contents of the list which you have entered but not the number of words which contain the character "a" in your list.

  • Even with all these explanations I don't understand how all this is supposed to work. And I don't see where you are searching for the letter "a" in your code.

    Anyway, just follow my suggestions: For the first task, check if the word exist in the array, if not - add it to the array. For the second task, to check if the word contains letter "a", use find(word,"a")>=0 expression.

  • This will find all the duplicates and count them with a Script.

    Link to File

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)