🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String › lastIndexOf
String.prototype.lastIndexOf() - JavaScript | MDN
The lastIndexOf() method of String values searches this string and returns the index of the last occurrence of the specified substring. It takes an optional starting position and returns the last occurrence of the specified substring at an index less than or equal to the specified number.
🌐
W3Schools
w3schools.com › jsref › jsref_lastindexof.asp
W3Schools.com
The lastIndexOf() method returns the index (position) of the last occurrence of a specified value in a string.
Discussions

What is LastIndexOf method and how it works?
Hello There, Can someone please explain with a simple example of the “LastIndexOf” method? I somehow can’t see to understand this one … Thanks in Advance Hara More on forum.uipath.com
🌐 forum.uipath.com
0
September 4, 2019
Can't unserstand how this example work. lastIndexOf() Method
I was looking at this example that get the name of a file after you select it in your pc. I writing becuase I don't understand, how in this case lastIndexOf() works! $('# More on stackoverflow.com
🌐 stackoverflow.com
Is there a LastIndexOf in SQL Server? - Stack Overflow
I am trying to parse out a value from a string that involves getting the last index of a string. Currently, I am doing a horrible hack that involves reversing a string: SELECT REVERSE(SUBSTRING(R... More on stackoverflow.com
🌐 stackoverflow.com
Slice/lastIndexOf method in javascript
Ok, lets start with 'lastIndexOf'. Imagine this const array = ['a', 'a', 'b', 'b', 'c', 'c', 'c'] Now what they ask you to do is tell them where in that array the last 'b' is located. So you do array.lastIndexOf('b') Which will give you the number 3, since the first position is 0. Now you can work with that information. Lets say you want to clear all the old data. The new data is the fancy 'c' the client wants, everything else is to be ignored. Slice takes two arguments, start of what you want to extract and end, but end is optional, which means you can just use the start. So if you know that the 'c' starts after 'b', your start will be the position after 'b'. lastIndexOf tells you where 'b' is, so you can combine them like this: const newArray = array.slice(array.lastIndexOf('b') + 1) This will return only the three 'c's. If you had used slice(2, 4), it would start at the 3rd element, which is a 'b', include the 4th element, also a 'b' and end at the 5th element (index 4). So it would ignore the rest and the new array would be ['b', 'b', 'c']. I'm on the phone in the train, so this could be poorly formatted and maybe not well explained, please let me know if so, I'll try again. More on reddit.com
🌐 r/learnjavascript
5
1
August 28, 2023
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › system.string.lastindexof
String.LastIndexOf Method (System) | Microsoft Learn
Reports the zero-based index position of the last occurrence of a specified Unicode character or string within this instance. The method returns -1 if the character or string is not found in this instance.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › lastIndexOf
Array.prototype.lastIndexOf() - JavaScript | MDN
The lastIndexOf() method of Array instances returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex.
🌐
W3Schools
w3schools.com › java › ref_string_lastindexof.asp
Java String lastIndexOf() Method
String myStr = "Hello planet earth, you are a great planet."; System.out.println(myStr.lastIndexOf("planet")); Try it Yourself » · The lastIndexOf() method returns the position of the last occurrence of specified character(s) in a string.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › lang › String.html
String (Java Platform SE 8 )
October 20, 2025 - public int lastIndexOf(int ch) Returns the index within this string of the last occurrence of the specified character. For values of ch in the range from 0 to 0xFFFF (inclusive), the index (in Unicode code units) returned is the largest value k such that: this.charAt(k) == ch is true.
🌐
Oracle
docs.oracle.com › cd › E05553_01 › books › eScript › eScript_JSReference254.html
Bookshelf v7.7: lastIndexOf() Method
Siebel eScript Language Reference > Siebel eScript Commands > String Objects > · This method finds the position of the last occurrence of a substring in a string
Find elsewhere
🌐
UiPath Community
forum.uipath.com › help
What is LastIndexOf method and how it works? - Help - UiPath Community Forum
September 4, 2019 - Hello There, Can someone please explain with a simple example of the “LastIndexOf” method? I somehow can’t see to understand this one … Thanks in Advance Hara
🌐
OutSystems
outsystems.com › ideas › 396 › lastindexof-text-function
Idea - LastIndexOf Text Function | OutSystems
OutSystems Ideas is a collaborative space where the community of OutSystems users comes together to share and discuss ideas for the product and community evolution and innovation.
🌐
Wavefront
docs.wavefront.com › ts_indexof.html
indexOf and lastIndexOf Functions | VMware Aria Operations for Applications Documentation
The lastIndexOf() function finds the last occurrence of the specified substring in the specified metadata string, and returns the starting position of that occurrence.
🌐
Flutter
api.flutter.dev › flutter › dart-core › String › lastIndexOf.html
lastIndexOf method - String class - dart:core library - Dart API
const string = 'Dartisans'; print(string.lastIndexOf('a')); // 6 print(string.lastIndexOf(RegExp(r'a(r|n)'))); // 6
🌐
Codecademy
codecademy.com › docs › java › strings › .lastindexof()
Java | Strings | .lastIndexOf() | Codecademy
March 2, 2023 - The .lastIndexOf() method searches a string for a specified value and returns the position of the match. It searches the string, from the end to the beginning, and returns the index of the specified value.
🌐
Kotlin
kotlinlang.org › api › core › kotlin-stdlib › kotlin.text › last-index-of.html
lastIndexOf | Core API – Kotlin Programming Language
fun CharSequence.lastIndexOf(char: Char, startIndex: Int = lastIndex, ignoreCase: Boolean = false): Int(source) Returns the index within this char sequence of the last occurrence of the specified character, starting from the specified startIndex.
🌐
Medium
medium.com › nerd-for-tech › basics-of-javascript-string-lastindexof-method-2cfe3de6ce33
Basics of Javascript · String · lastIndexOf() (method) | by Jakub Korch | Nerd For Tech | Medium
June 7, 2021 - The lastIndexOf() method returns the index of the last occurrence of the specified string value within the searched string. Search happens backwards by default starting at the last index of the searched string moving towards the index 0. Optionally ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-string-lastindexof-method
JavaScript String lastIndexOf() Method - GeeksforGeeks
July 16, 2024 - The lastIndexOf() method in JavaScript is used to search for the last occurrence of a specified substring within a string.
🌐
Arduino
docs.arduino.cc › built-in-examples › strings › StringIndexOf
String indexOf() and lastIndexOf() Method
String indexOf() and lastIndexOf() Method · How to Use String length() String length() and trim() Commands · String replace Function · String startsWith and endsWith Functions · String substring Function · String to Int Function · Button Mouse Control ·
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › system.collections.generic.list-1.lastindexof
List .LastIndexOf Method (System.Collections.Generic) | Microsoft Learn
A List<T> of strings is created, with one entry that appears twice, at index location 0 and index location 5. The LastIndexOf(T) method overload searches the entire list from the end, and finds the second occurrence of the string.
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › system.array.lastindexof
Array.LastIndexOf Method (System) | Microsoft Learn
Returns the index of the last occurrence of a value in a one-dimensional Array or in a portion of the Array.