2017-10-05

String get all content between two characters

          You can get content between symbols even there are other same characters. You can extract a string between two delimiters or two string or symbol.

Example:

String-> Some Text [Id-123]

Output-> Id-123

You can achieve same functionality with out using Regular expression. You can use String operaton.
For any programming like Java, JavaScript, C, C++, .Net, AngularJs, You can Use String operation.

String str = "Some Text [Id-123]";

String str2 =  str.substring(str.lastIndexOf("[") + 1, str.lastIndexOf("]")); 

Output-> Id-123

It will work for any symbol or characters.

No comments:

Post a Comment