Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find the last occurrence of char in a string

Does there exist any RTL Delphi function to determine the position of the last occurrence of a char in a string?

like image 340
DelphiNewbie Avatar asked Apr 30 '11 20:04

DelphiNewbie


People also ask

How do you find last occurrence of a character in a string Excel?

You can use any character you want. Just make sure it's unique and doesn't appear in the string already. FIND(“@”,SUBSTITUTE(A2,”/”,”@”,LEN(A2)-LEN(SUBSTITUTE(A2,”/”,””))),1) – This part of the formula would give you the position of the last forward slash.

How do you find the last occurrence of a character in a string in python?

The rfind() method finds the last occurrence of the specified value. The rfind() method returns -1 if the value is not found. The rfind() method is almost the same as the rindex() method.

How do you find the first and last occurrence of a character in a string?

The idea is to use charAt() method of String class to find the first and last character in a string. The charAt() method accepts a parameter as an index of the character to be returned. The first character in a string is present at index zero and the last character in a string is present at index length of string-1 .

How do I get the last character of a string in C++?

You can use string. back() to get a reference to the last character in the string. The last character of the string is the first character in the reversed string, so string. rbegin() will give you an iterator to the last character.


1 Answers

try the LastDelimiter function which is part of the SysUtils unit.

like image 77
RRUZ Avatar answered Sep 25 '22 08:09

RRUZ