Questions tagged [lastindexof]
125 questions
0
votes
2 answers
find the last occurrence on column A and return the value from the same row on C (Apps Script)
I have a data sheet, containing:
|ItemCode | Item | Version|
The goal is to get the last version of the item and increment it by 0.1, so if the item's version is 03, then its new version would be 3.1 once this function was called.
The code below…

onit
- 2,275
- 11
- 25
0
votes
1 answer
ArrayList lastIndexof
import java.util.Scanner;
import java.util.*;
public class bracketMatch {
public bracketMatch() {
}
public static void main (String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("enter seq");
String[]…

ToM
- 37
- 4
0
votes
2 answers
Split full name into first, last and titles
example of the column
I have a column called FULLNAME which consists of a variation of FIRSTNAME and SURNAME separated by a space, and TITLE, FIRSTNAME and SURNAME, all separated by a space. So for example, I could have JOHN SMITH or DR JOHN…

Jay
- 5
- 6
0
votes
1 answer
Use regex in indexOf and lastIndexOf
In Java, is there a way to use indexOf() or lastIndexOf() with a regex expression inside, like used in replaceAll(), to find out the indexes (of the first and last indexes of a character) that match the regex expression in the String ?

Pepe
- 301
- 4
- 13
0
votes
1 answer
Explanation of lastIndex of: and firstIndex of: used in a string in Swift
I am solving a programming problem in Swift and I found a solution online which I don't totally understand, the problem is: Write a function that reverses characters in (possibly nested) parentheses in the input string. the solution is
var…

Rich
- 115
- 1
- 9
0
votes
3 answers
How do I use Javascript to remove text before and including the last instance of a character in multiple elements?
I'm new to Javascript, so I'm doing my best to learn, but I'm stuck on how this works. I have html that looks similar to this:
I…
string/string/Red
string/string/Green
string/string/Blue

kcm
- 1
- 1
0
votes
1 answer
.subString until last sentence ends
I'm using a news API, which partly replies with cut off text, due to character restriction. They end with '...', '[...]' or without any indication.
I want to cut off everything after the last sentence, so I have clean text.
This is my current…

Arti
- 1
- 1
- 2
0
votes
2 answers
Best method to get substring after a given word in a String?
I have a long String, which is a json files contents. Somewhere in this String, it contains the following: "totalWinAmount":100
To find and return this value, I'm currently doing this:
int totalWinAmountIndex =…

James
- 749
- 1
- 9
- 22
0
votes
2 answers
Java substring using lastindexOf return a specific length
I'm using JAVA and I have a string called example that looks like;
example = " id":"abcd1234-efghi5678""tag":"abc" "
NOTE: I have't escaped the "'s using \ but you get the idea..
...I want to just return;
abcd1234
...I've been trying using…

Codename21
- 3
- 1
- 3
0
votes
3 answers
JS Substring between word and space
I have a string like
"username 234234 some text"
And I would like to devide them in
"username"
"234234"
and "some text"
I tried with split and substring but failed with finding the second space, most often a blank text got returned.
Thank you very…

Tester3
- 101
- 1
- 2
- 10
0
votes
7 answers
How to fetch a value from a string in javascript?
I want to fetch a particular value from a javascript string without using methods like indexOf or substr. Is there any predefined method of doing so?
For e.g., I have a string,
var str = "a=1|b=2|c=3|d=4|e=5|f=6";
I want to fetch the value of c…

Frosted Cupcake
- 1,909
- 2
- 20
- 42
0
votes
0 answers
Java - inner ArrayList loop not doing intended function
This code works as expected: It iterates the outer ArrayList (coverage), and iterates inner ArrayLists (covArrayList), and when an inner ArrayList contains "noBaseData", 5 empty elements are added to the end.
//add empty elements for coverage…

jacobshillman
- 49
- 9
0
votes
3 answers
c# - is there anything like BeforeLastIndexOf?
I wanted to know if there is anything like "BeforeLastIndexOf". I'm new to c# and don't really know how "LastIndexOf" and "IndexOf" works. What I'm trying to achive is that for example the user types in a directory and it deletes from the string the…

magiccheese
- 111
- 2
- 9
0
votes
1 answer
How to split a string in Java using .indexOf()
I am a trying to create a program that takes input from the user (assuming 3 words) and outputs the first word capitalised, the second in lower case and the third word only the first two characters. I don't understand why the third one is printed…

Diana Constantina
- 11
- 1
- 2
0
votes
3 answers
Get Substring of A String with Spaces and Quotes using IndexOf
I have the following String and would like to extract the contents of rule i.e. My Rule Description Looks Like This:
rule "My Rule Description Looks Like This"
followed by some white space other characters such as quotes".
When i use…

Orby
- 428
- 1
- 9
- 24