Questions tagged [lastindexof]
125 questions
0
votes
2 answers
LastIndexOf function usage
I am trying to learn how to use lastIndexOf function, but the code doesn't work for me. After clicked the button, I just get the whole text, not only the extension. What am I doing wrong?
private String getExtension(String s)
{
char dot='.';
…

digrev
- 97
- 1
- 6
0
votes
3 answers
Extracting text from ftp address
I'm creating small FTP Client and stuck on small issue, can you help me to sort it out please.
So I'm taking text from comboBox1.Text witch is lets say "/test/sql/it/"
But for creating new directory I need to extract "it" and "/test/sql/"
"it" as…

zee
- 415
- 1
- 7
- 13
0
votes
2 answers
button name last letters
I have about about 30 buttons each contain text and then a number and i just need to put the number in the other button
like in the example button1.Name should be test3
Is this possible?
i know that LastIndexOf doesnt work like this, it's for giving…

Kapein
- 175
- 13
0
votes
1 answer
Highlight active menu item
I have a menu created by a list. I would like to be able to highlight the current menu item.
With this script I'm able to match the last bit of the url (everything after the last /), but I need the script to match the two previous folders in the url…

Meek
- 3,086
- 9
- 38
- 64
0
votes
1 answer
Inserting text before the second last instance of an element in a string VB.net
I've got a document like the following layout (in reality it's much bigger):
I'm importing that html from elsewhere and I…
Yes

MissCoder87
- 2,669
- 10
- 47
- 82
-1
votes
1 answer
really simple question about why lastIndexOf() returns -1 in this case
i have this piece of string and i want to get the last index of "n" in it but instead of returning 200+ or something it returns -1. which i did not find it . why is that…

hamdi salim
- 9
- 4
-1
votes
1 answer
Javascript - Get index of penultimate occurrence of a string?
I have this string:
IESA1V1Ent/Cuerpo/Asiento:1/DatosRepercusion/REP_NUMDocumentoIdent/
How can I get the index of the penultimate /?
IESA1V1Ent/Cuerpo/Asiento:1/DatosRepercusion Index Of->/ REP_NUMDocumentoIdent/
Thanks!

Iñigo
- 1,877
- 7
- 25
- 55
-1
votes
1 answer
Java: lastIndexOf not working on String array
I extracted data from the xpath using HtmlUnit and have this:
String[] data = new String[10]; // number of columns
data[0] = page.querySelector(".sprop-product-heading").getTextContent().trim().toString();
data[d]... so on.
But when I use the…

jameslem
- 85
- 2
- 12
-1
votes
5 answers
Removing the last element of an ArrayList
I'm new to Java and I'm stuck with an exercise I've been trying to solve for over a week now and I don't know what I'm doing wrong.
I need to delete the last elements of an ArrayList, an integer in this case.
The problem is that when I run the…

pherkan
- 9
- 1
- 4
-1
votes
2 answers
Java - Getting last occurrence of object in list with only partial data
Not sure if the title makes sense. but I am currently stuck trying to get the last occurrence of an object in a list. Let's say the object is compromised of ages (integers) and names (strings). I'm trying to get the last occurrence of the age "18"…

Racco Taco
- 15
- 7
-1
votes
3 answers
How to get the last index of a specific character before a different one
Sorry, It's kinda hard to explain it for me.
I want to get the index of the last new line character which placed before a different character in a C# application.
for example, I want the index of the \n which is placed before…

Ghasem
- 14,455
- 21
- 138
- 171
-1
votes
1 answer
why does lastindexOf() not find the last element
I'm trying to extract a sub string from a string with Javascript and have come up with the following: http://jsfiddle.net/bbhbz7r6/1/ for some reason however, .lastindexOf() doesn't find the last occurrence of

stdcerr
- 13,725
- 25
- 71
- 128
-1
votes
1 answer
How to insert new line(vbnewline) after specific word in richtextbox vb.net
How to insert new line(vbnewline) after specific word in richtextbox vb.net
heres the ex.
ITEM # 1234 BLUE 100.00 ITEM # 3214 RED ITEM # 1235 GREEN 120.00 ITEM # 3514 ORANGE
The output should be
ITEM # 1234 BLUE 100.00
ITEM # 3214 RED 211.00
ITEM…

Ronald Jose
- 25
- 3
-1
votes
1 answer
How can I use javascript to get a substring of whatever is between two parenthesis?
I am trying to return just "AA" using javascript.
This doesn't work.
var myStr = "Item Code Alpha Tengo (AA)";
var newStr = myStr.substring("(",myStr.lastIndexOf(")"));

silvster27
- 1,916
- 6
- 30
- 44
-2
votes
1 answer
JavaScript Array Min Value Index
It give me correct index when i give fixed array i.e
BT_input = [11, 10, 10, 14]
But when i get array values from user this Return -1 instead of correct index ?