How to find blank space in the string

Hi folks,

I am trying to get a blank space in the string and cut it from the next character.
James Smith ---> James S


Any help will be appreciated.
Thanks.







Hi Meri,

Could you Please try to use below code :

SyntaxEditor Code Snippet

Substr("James Smith",0,String_LastIndexOf("James Smith"," ")+2)



"String_LastIndexOf" can be found under "text" module in manage dependencies.


Do let me know if it works.


Kind Regard's,

Lakshmi Kumar

Hi Lakshmi Kumar,

I tried the way you suggest, but it did not work.

Hi Meri, 

I have attached the sample oml for your reference.

Please have a look or you can share one for analysis.

 

Kind Regards,

Lakshmi Kumar

Hi Meri,

Lakshmi Kumar's solution may not works if you have additional space in the end of string like "James Smith ". Try to use Index(...) instead of String_LastIndexOf(...).

Solution

Hi,

you can use the function that I show you, to find the first space, and to know the index.



And then use the bottom function, to get what you want from the string. Then tell me if this solution helped you.


Cheers,
Nuno

Solution


Hi there,
Nuno your version worked perfectly.


Thank you all for your help!

You don't have to thanks Meri, I'm always happy when I can help.
Regards,
Nuno Miguel Verdasca