indexof Questions

9

Solved

Let's say I have a URL: http://something.com/somethingheretoo and I want to get what's after the 3rd instance of /? something like the equivalent of indexOf() which lets me input which instance...
Giraudoux asked 27/9, 2011 at 13:49

2

Solved

Is there a find function in Rust's standard library which searches for a substring starting at a given index in the string? Just like indexOf in JavaScript.
Ardeb asked 19/2, 2021 at 6:53

6

Solved

I am seeking a way to search a string for an exact match or whole word match. RegEx.Match and RegEx.IsMatch don't seem to get me where I want to be. Consider the following scenario: namespace test...
Memoirs asked 26/6, 2014 at 18:4

5

Solved

What would be the simplest way to locate the index of the third space in a string. My goal is to get CCC out of this space separated list: AAAA BBBB CCCC DDDD EEE. where A and B and D are fixed le...
Madonnamadora asked 15/1, 2013 at 21:51

4

Solved

I have a json object that looks like this (prodused by i3-msg -t get_workspaces. [ { "name": "1", "urgent": false }, { "name": "2", "urgent": false }, { "name": "something", "urgent": f...
Hoist asked 31/1, 2017 at 13:9

3

Solved

I have a node.js script where I want to find if a given string is included inside an array. how can I do this? Thanks.
Blatant asked 24/1, 2016 at 12:49

3

Solved

I'm just a beginner in javaScript and have a background in python. I was trying this exercise to check if every character of the string2 is contained within the string1. For example, if string1 is ...
P asked 5/7, 2017 at 22:11

6

Solved

First of all, please correct me If I am wrong. I want to find index of Item (i.e String value) from ArrayList<CustomType> without using For Loop. POJO: id; name; Code: ArrayList<POJO&...
Beauty asked 12/11, 2012 at 9:44

9

Solved

I have a variable activeUserName and a variable manager1. How can I check if activeUserName contains at least three characters, that are in manager1? (The position of those characters doesn't matte...
Nurserymaid asked 7/8, 2020 at 15:1

1

Solved

I am creating a substring from a string with non-combining diacritics that follow a space. When doing so, I check the string with .Contains() and then perform the substring. When I use a space char...
Vivavivace asked 30/6, 2020 at 23:39

4

I am new to JavaScript and I'm getting an error as below. Uncaught TypeError: time.indexOf is not a function Gee, I really thought indexOf() really was a function. Here is a snippet of my code...
Annoying asked 7/4, 2016 at 17:22

6

Solved

I am learning Javascript and don't understand why the indexOf below returns -1: var string = "The quick brown fox jumps over the lazy dog"; console.log (string.indexOf("good"));
Cuttle asked 21/12, 2011 at 6:31

3

Solved

I want to retrieve the linenumber in a stringlist (loaded from a file). Indexof seems to match exactly. Is there a way to retrieve the line with a wildcard-version of Indexof? something like SL.In...
Withal asked 14/6, 2011 at 9:15

6

Solved

All the examples I see of using the IndexOf() method in List<T> are of basic string types. What I want to know is how to return the index of a list type that is an object, based on one of the...
Chichihaerh asked 14/10, 2009 at 19:54

5

I am getting -1 from myarray.indexOf(element) even when element appears to be in myarray. Here's some code snippets: function createChangeRecord( old_array, new_array ) { var nds = new_array.sl...
Pliam asked 8/1, 2013 at 19:42

3

Solved

I am currently using str.indexOf("word") to find a word in a string. But the problem is that it is also returning parts of other words. Example: "I went to the foobar and ordered foo." I want the ...
Selfsacrifice asked 8/10, 2012 at 0:4

12

Solved

Say I've got this imageList = [100,200,300,400,500]; Which gives me [0]100 [1]200 etc. Is there any way in JavaScript to return the index with the value? I.e. I want the index for 200, I get ...
Delfinadelfine asked 8/9, 2011 at 10:47

4

In Java, we can use indexOf and lastIndexOf. Since those functions don't exist in PHP, what would be the PHP equivalent of this Java code? if(req_type.equals("RMT")) pt_password = message.substri...
Millsaps asked 14/11, 2014 at 5:3

2

Solved

I am using the youtube api to search for youtube videos. The videos will then be displayed on #searchBar with the video id ex. NJNlqeMM8Ns as data-video. I get the video id by pressing on a img: &...
Apprentice asked 22/9, 2019 at 10:50

1

Solved

Before Swift 5, I had this extension working: fileprivate extension String { func indexOf(char: Character) -> Int? { return firstIndex(of: char)?.encodedOffset } } Now, I get a deprecat...
Hengist asked 27/3, 2019 at 19:2

7

This is the code I found as an answer to this question: Write a JavaScript program to remove duplicate items from an array (ignore case sensitivity). var arr1=[3, 'a', 'a', 'a', 2, 3, 'a', 3, 'a',...
Cavern asked 5/8, 2017 at 13:46

4

I have a for loop which returns an array. Return: 1st loop: arr[0] arr[1] arr[2] arr[3] Here the length I get is 4 (Not a problem). Return: 2nd loop arr[4] arr[5] arr[6] arr[7] arr[8] Her...
Crinkly asked 10/7, 2012 at 13:1

6

Solved

In Python we can get the index of a value in an array by using .index(). But with a NumPy array, when I try to do: decoding.index(i) I get: AttributeError: 'numpy.ndarray' object has no att...
Mokpo asked 6/8, 2013 at 11:32

8

Solved

This Java code is giving me trouble: String word = <Uses an input> int y = 3; char z; do { z = word.charAt(y); if (z!='a' || z!='e' || z!='i' || z!='o' || z!='u')) { for (int i = 0; i...
Technique asked 3/10, 2013 at 13:47

1

I have an ordered vector of unique integers in R and I want to find the index of the element closest to but less than or equal to some value. For example, for the vector 4 8 15 16 23 42 and the sea...
Erotomania asked 20/7, 2015 at 21:14

© 2022 - 2024 — McMap. All rights reserved.