Questions tagged [find-occurrences]

435 questions
0
votes
1 answer

Count Total Amount Of Specific Word In a String JavaScript

I want to find out how many time a specific words occur in a String JavaScript, or we can say the total amount of matched/match word with the complete sentence string in JavaScript. query = "fake"; var inputString = "fakefakefakegg fake 00f0 221…
Farbod Aprin
  • 990
  • 1
  • 10
  • 20
0
votes
2 answers

R - Return column name for row where first given value is found

I am trying to find the first occurrence of a FALSE in a dataframe for each row value. My rows are specific occurrences and the columns are dates. I would like to be able to find the date of first FALSE so that I can use that value to find a return…
0
votes
2 answers

find the occurrences of 2 "linked lists " in python

i have to write a program that get the number of time that an item (linked to another list)occours into a list , i write an example to understand: i have 2 lists: l=[13, 14, 14, 8, 13, 13, 14, 14, 8, 13 ]…
0
votes
6 answers

How to build a function that searches for string occurrences?

I need help Writing a function subLength() that takes 2 parameters, a string and a single character. The function should search the string for the two occurrences of the character and return the length between them including the 2 characters. If…
Damian
  • 29
  • 1
  • 7
0
votes
1 answer

How do I add multiple lines of txt into an array and compare each letter to a user-input letter?

I'm trying to create a program that reads a txt document and counts the occurrences of a letter that the user inputs. It seems that my for-loop to index the letters is incorrect because it only reads the first or last line of the document. Any…
tygrrr21
  • 3
  • 2
0
votes
1 answer

How to return a dictionary composed of the number of occurrences of each word of 2 letters

Write a function that prints the dictionary in the following manner: Key : GT - Value : 1 Key : CT - Value : 8 Code: def occurrences2letters(sequence): dico = {} for i in range(len(sequence)-1): key = sequence[i]+sequence[i+1]…
0
votes
1 answer

Calculate occurrences in the last 7 days in SQL

I have a table with CustomerID and ArrivalDateTime (datetime). I would like to calculate the occurrence of the CutomerID within the last 7 days of each Arrival Date. I came up with the below SQL statement however it is not working. Can someone help…
0
votes
1 answer

Get all the occurrences with window.find

I want to highlight in a text all the occurrences from a word that I have in my URL. For the first occurrence everything works fine. But I don't know how to go to the next one. highlightText: function(urlParams) { var urlSearch =…
0
votes
1 answer

Frequency of occurrence of a digit?

I have tried to solve this algorithm in JavaScrip and I couldn't make it. I have done it in Java but I can't find a way to solve this is JS. If somebody can show me and explain to me the solution I would be grateful to the moon and back :) The…
Nemanja15
  • 3
  • 2
0
votes
3 answers

How to get the occurrence of the selected word in Javascript

Let's say I have a DIV containing text, like so:
Hello world test Hello world test 2 Hello world
My function for getting the word when selecting the text is: function getWord() { var txt = document.getSelection(); var…
Gregory R.
  • 1,815
  • 1
  • 20
  • 32
0
votes
3 answers

C program to remove all occurrences of a WORD in string

The output of my code is incorrect. For example, if I input "joy is joyful", then want to remove the word "joy", the output should be " is joyful", but instead the output is the same as the input. Here is the full…
0
votes
2 answers

How to create a co-occurrence matrix of elements that co-occur in a row in R?

I'm a rookie in R and I want to create a co-occurrence matrix based on which elements co-occur in a row. Basic Example of Aspired Outcome Say you have this table: df <- data.frame(ID = c(1,2,3), V1 = c("England", "England",…
silviaegt
  • 317
  • 3
  • 12
0
votes
3 answers

javascript: Find occurrence of element string against array of elements. Occurrence returns 0

I have a list of n items. Each item has a title with the format [first part] - [color]. Items have unique colors.
Alfa Romeo - Red
0
votes
3 answers

How to find the occurrence count of sequence's largest element in C++?

C++ beginner here. I'm trying to write a program without the usage of arrays that would take a N number and allow the user to write a sequence of elements consisting of the N number (e.g. the N is 5, then the sequence of elements should be consisted…
0
votes
2 answers

How to aggregate the occurrence with enum

I have a ScenarioGenerator class to generate the Scenario. And in the Audit class, I set the function to decide how many scenarios to be generated and wanted to print out the occurrence of each enum type (Gender in this case). I've referred to…
Woden
  • 1,054
  • 2
  • 13
  • 26