Split a string without a delimiter

Hello,
Can anyone please help me to split a string without a delimiter.
Example: OtherSupplierLogisticsDesign
to
Other
Supplier
Logistics
Design

Hi @Gopalakrishnan_K,

String[] YourVariable = System.Text.RegularExpressions.Regex.Split("OtherSupplierLogisticsDesign", "(?<!^)(?=[A-Z])");

YourVariable is an array type containing string items.

Later you can poll the array like so

YourVariable(0).ToString.Trim resulting in  "Other"
YourVariable(1).ToString.Trim resulting in "Supplier"
YourVariable(2).ToString.Trim resulting in "Logistics"
YourVariable(3).ToString.Trim resulting in  "Design"

So each of the purple piped lines will be places where the string will be split.
image

Reference : C# string.split() separate string by uppercase - Stack Overflow

8 Likes

As an alternate:
grafik
[A-Z][a-z]+

1 Like