472
Views
7
Comments
Solved
How to find blank space in the string
Question

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.







2025-11-19 06-14-01
Miguel Verdasca
Champion
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

2025-07-22 10-24-12
Lakshmi Kumar Yadav

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

2019-07-08 11-15-14
Meri Hayrapetyan

Hi Lakshmi Kumar,

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

2025-07-22 10-24-12
Lakshmi Kumar Yadav

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

SampleSpace.oml
2023-09-28 14-21-55
Daryna Kravets

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(...).

2025-11-19 06-14-01
Miguel Verdasca
Champion
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

2019-07-08 11-15-14
Meri Hayrapetyan


Hi there,
Nuno your version worked perfectly.


Thank you all for your help!

2025-11-19 06-14-01
Miguel Verdasca
Champion

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

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.