Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the string after a string from a string

Tags:

string

php

what's the fastest way to get only the important_stuff part from a string like this:

bla-bla_delimiter_important_stuff 

_delimiter_ is always there, but the rest of the string can change.

like image 558
Alex Avatar asked Nov 19 '10 00:11

Alex


People also ask

How do you get a string after a specific string in Python?

Python Substring After Character You can extract a substring from a string after a specific character using the partition() method. partition() method partitions the given string based on the first occurrence of the delimiter and it generates tuples that contain three elements where.

How do you get the string after a certain character?

To get the substring after a specific character, call the substring() method, passing it the index after the character's index as a parameter. The substring method will return the part of the string after the specified character. Copied! We used the String.

How do you split a string after a specific character in Python?

Python String | split()split() method in Python split a string into a list of strings after breaking the given string by the specified separator. Parameters : separator : This is a delimiter. The string splits at this specified separator.

How do you find before and after substring in a string?

Use the substring() method to get the substring before a specific character, e.g. const before = str. substring(0, str. indexOf('_')); . The substring method will return a new string containing the part of the string before the specified character.


1 Answers

here:

$arr = explode('delimeter', $initialString); $important = $arr[1]; 
like image 142
jon_darkstar Avatar answered Sep 24 '22 06:09

jon_darkstar