indexof Questions

7

Solved

I have an MVC3 C#.Net web app. I have the below string array. public static string[] HeaderNamesWbs = new[] { WBS_NUMBER, BOE_TITLE, SOW_DESCRIPTION, HARRIS_WIN_THEME, COST_BOGEY }; I wa...
Nebulosity asked 15/2, 2012 at 19:44

29

Solved

For example, assuming that x = filename.jpg, I want to get filename, where filename could be any file name (Let's assume the file name only contains [a-zA-Z0-9-_] to simplify.). I saw x.substring(...
Fasto asked 22/11, 2010 at 21:24

13

Solved

I wrote this: public static class EnumerableExtensions { public static int IndexOf<T>(this IEnumerable<T> obj, T value) { return obj .Select((a, i) => (a.Equals(value)) ? i : -1...
Exchangeable asked 17/8, 2009 at 21:37

11

Solved

I know c# has Array.FindAll and Array.IndexOf. Is there a Array.FindAllIndexOf which returns int[]?
Furriery asked 4/5, 2012 at 6:2

14

I need to check if an array contains another array. The order of the subarray is important but the actual offset it not important. It looks something like this: var master = [12, 44, 22, 66, 222,...
Witherspoon asked 8/12, 2015 at 9:7

9

Solved

I would like to remove the domain/computer information from a login id in C#. So, I would like to make either "Domain\me" or "Domain\me" just "me". I could always check for the existence of either,...
Indecency asked 9/10, 2008 at 1:8

19

Solved

I'm trying to find the positions of all occurrences of a string in another string, case-insensitive. For example, given the string: I learned to play the Ukulele in Lebanon. and the search strin...
Lagan asked 4/8, 2010 at 22:45

10

Solved

We are given a string, say, "itiswhatitis" and a substring, say, "is". I need to find the index of 'i' when the string "is" occurs a second time in the original string. String.indexOf("is") will r...
Distich asked 26/9, 2013 at 18:28

12

Solved

I have a 2d array like this: var arr = [[2,3],[5,8],[1,1],[0,9],[5,7]]; Each index stores an inner array containing the coordinates of some element. How can I use Array.indexOf() to check if th...
Briefing asked 24/7, 2014 at 20:18

7

Solved

I am currently trying to figure out how to solve the above named problem. Specifically I want to check if the string does not contain the word "stream" both in capital and lowercase letters. Here'...
Excurrent asked 20/12, 2016 at 22:35

3

Solved

On my travel on learning basic javascript, I have come across the Code Wars Website, which confronts one with different problems. I'm very new to JavaScript development and Code Wars has been of ma...
Kt asked 3/9, 2020 at 12:7

11

Solved

Unless I am missing an obvious built-in method, what is the quickest way to get the nth occurrence of a string within a string? I realize that I could loop the IndexOf method by updating its start...
Dichloride asked 9/10, 2008 at 10:20

5

Solved

I need to have the index of an object in array so I can delete this part of the array. I tried using this: var index = this.urenRegistratie.indexOf(newDatum); But it keeps returning -1 and I don...
Albuminous asked 21/11, 2019 at 9:8

7

Solved

I am writing a script for a Google Docs Spreadsheet to read a list of directors and add them to an array if they do not already appear within it. However, I cannot seem to get indexOf to return a...
Footlambert asked 11/6, 2013 at 13:3

3

I was studying big O notation for a technical interview and then I realized that javascript's indexOf method may have a time complexity of O(N) as it traverses through each element of an array and ...
Server asked 13/9, 2016 at 6:30

6

Solved

I am trying to find how many times the word "Serotonin" appears in the gathered web data but cannot find a method for finding the number of times. IEnumerator OnMouseDown() { string GatheredDat...
Unbalance asked 27/8, 2018 at 1:23

22

Solved

In javascript, is there an equivalent of String.indexOf(...) that takes a regular expression instead of a string for the first parameter, while still allowing a second parameter ? I need to do some...
Colpitis asked 7/11, 2008 at 22:3

12

Solved

I am already trying for over an hour and cant figure out the right way to do it, although it is probably pretty easy: I have something like this : foo/bar/test.html I would like to use jQuery to ...
Madalene asked 4/12, 2011 at 15:59

6

Solved

For instance, a variable named arrayElements of type array contains: [{id:1, value:5},{id:2, value:6},{id:3, value:7},{id:4, value:8}]. How do I get the position of the array element with id === 3...
Bandoline asked 4/11, 2014 at 15:21

3

Solved

I have a string in an Array that contains two commas as well as tabs and white spaces. I'm trying to cut two words in that string, both of them before the commas, I really don't care about the tabs...
Tyika asked 26/3, 2014 at 17:44

7

I have an array which contains multiple same values ["test234", "test9495", "test234", "test93992", "test234"] Here I want to get the index of eve...
Keli asked 14/4, 2016 at 18:54

3

Solved

I am trying to apply style to the text selected by the user(mouse drag) for which I need to get the start and end index of the selected text. I have tried using "indexOf(...)" method. but it retu...
Precipitancy asked 13/6, 2019 at 5:47

19

Solved

I've been surfing around a little trying to find an efficient way to do this, but have gotten nowhere. I have an array of objects that looks like this: array[i].id = some number; array[i].name = so...
Couch asked 11/5, 2012 at 19:30

9

Solved

I have an app running which looks at items in a queue, then based upon certain keywords a category is applied - then it is inserted into a database. I'm using IndexOf to determine if a certain key...
Danuloff asked 21/2, 2012 at 15:19

6

Solved

I have an ArrayList in Java, and I need to find all occurrences of a specific object in it. The method ArrayList.indexOf(Object) just finds one occurrence, so it seems that I need something else.
Perugia asked 16/12, 2012 at 10:54

© 2022 - 2024 — McMap. All rights reserved.