Hi
Is it possible to have an expression in stimulsoft where you pass through a string, seperated by spaces ,to be split by the first letter of each word inside the string?
This is to gather the initials from first names.
For example;
My string is Alfa Bravo Charlie
I want the expression to return:
A B C
My C# knowledge is very limited
Thank you
Split string expression
-
- Posts: 6263
- Joined: Tue Mar 20, 2018 5:34 am
Re: Split string expression
Hello,
As a way, you can use Regex:
Thank you.
As a way, you can use Regex:
Code: Select all
{System.Text.RegularExpressions.Regex.Replace(YourValue, @"[^A-Z,\W]", "")}
Re: Split string expression
Thank you for the response.Lech Kulikowski wrote: ↑Thu May 31, 2018 9:39 pm Hello,
As a way, you can use Regex:Thank you.Code: Select all
{System.Text.RegularExpressions.Regex.Replace(YourValue, @"[^A-Z,\W]", "")}
Using that expression my string is returned:
ALFABRAVOCHARLIE
Instead of A B C
-
- Posts: 6263
- Joined: Tue Mar 20, 2018 5:34 am
Re: Split string expression
Hello,
We have checked:
Thank you.
We have checked:
Thank you.
- Attachments
-
- Capture.PNG (51.79 KiB) Viewed 4121 times
Re: Split string expression
Hi Thank you, i see it's working with that example.
I noticed my string's values will always be in UPPER case, hence not working 100% for me.
Can the expression be amended to cater for uppercase characters inside the string? My current result for ALFA BRAVO CHARLIE returns: ALFABRAVOCHARLIE
I noticed my string's values will always be in UPPER case, hence not working 100% for me.
Can the expression be amended to cater for uppercase characters inside the string? My current result for ALFA BRAVO CHARLIE returns: ALFABRAVOCHARLIE
-
- Posts: 6263
- Joined: Tue Mar 20, 2018 5:34 am
Re: Split string expression
Hello,
You can change regex pattern as you needed for your incoming string:
https://docs.microsoft.com/en-us/dotnet ... -reference
Thank you.
You can change regex pattern as you needed for your incoming string:
https://docs.microsoft.com/en-us/dotnet ... -reference
Thank you.