Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Simple One: How to fetch substring from last of the word

Former Member
0 Kudos

Say there is variable = 'abc@rediffmail.com'.

Everytime I want to retrieve @rediffmail.com from this string for validation .

One method is : I have used SPLIT at '@' but at that case in second variable I will get rediffmail.com instead of @rediffmail.com.

This method is ok . but can you suggest some other method.

4 REPLIES 4

Former Member
0 Kudos

Hi,

The above is the best method to use. Without a delimiter you cannot identify what substring to fetch.

Using the above method, split on '@' get the substring and concatenate '@' again to get the desired substring.

Regards,

Vinodh.

Former Member
0 Kudos

HI

Find the number of characters before the @.

then

string_value = variable+i(15).

where I is the number of character before @.

Please reward points for all helpfull answers

Former Member
0 Kudos

Your method is the efficient way to retrieve the last word.

Split the string at '@' and then if you need to have '@' within your string, CONCATENATE it.

Regards,

pavan.

Former Member
0 Kudos

I am using my method only that is SPLIT

Thanks a ton everybody