New Feature: Splitstring

I believe it will be very helpful if a Splitstring component is added to the Text plugins.

This component is used extensively in Linx4, and creating regular expressions for each field to be extracted will be too time consuming

Hi Kobus,
thanks for your contribution. It is much appreciated.

Working with strings is indeed a common and important task in Linx. Are you perhaps aware that the Expression Editor allows for splitting and formatting strings? There is a help page on the site that describes this feature somewhat:

http://linx.twenty57.com/Support/BuiltIn/Tools/ExpressionEditor/

Please let us know if this helps at all regarding what you are wanting to do with strings.

Apologies if you have already found this feature. In this case please let us know what you are trying to do with the strings that cannot be done in the Expression Editor.

Thanks a lot, Franz

Hi Franz,

Yes I have seen this, but it will be very time consuming to do in this manner

Hi Kobus,
could you please send us some examples of strings you need to split? We would like to get a better idea as to what you are trying to accomplish.
Thanks a lot, Franz

Kobus

You can use a single RegularExpression to parse and return more than one field. Here is an example that parses a simple csv line:

Text: john,wayne,123,99999
Regular expression: ([^,]+),([^,]+),([^,]+),(\w+)

The regular expression will parse every field and return it as Group#:
Group1 = john
Group2 = wayne
Group3 = 123
Group4 = 99999

Please send us some examples of what you commonly do with SplitString.

Hi Franz,

See below strings and where they’ll split:

Fixed:

This is a very simple task to perform by utilising the Splitstring component, and is very time efficient

Sample of delimited:

Hi, can we please relook at the possibility of adding a Splitstring function into L5? if the functionality available in the L4 component can be replicated, it will save a huge amount of dev time on out side

Please advise

Hi Kobus,

Will look into the L4 capability and the gaps to L5.

In the meantime, there is a “Split” function for Strings on the Expression editor. I’m attaching an example of how to use it.

SplittingStrings.lsoz (3.0 KB)

The basic concept is that the string gets split up on a specific character (i.e. a comma) into a List of separate strings, which you can then use.

I’ve done 2 cases, one with Comma’s and One with spaces (i.e. a Fixed space string).

There is a BUT in both cases though.

For a Comma delimited file, with Comma’s in the text, this method will split there as well.

For Fixed space lines, you’ll need to remove the excess spaces and then split it.

Kobus, please give us some samples of common scenarios you face.

Hi,

I just made another example. By looking at the fields provided up top, it seems like these could come from a file. If that is the case, the Splitting fields functionality is already provided for in the TextFileRead component.

I’ve added an example of both the Comma and Fixed files:

SplittingStrings.lsoz (5.7 KB)

CommaFile.txt (40 Bytes)

SpaceFile.txt (71 Bytes)

First you must select “Line by line” as the Read type, then you can define the fields. A very nice add-on is you can load a sample file to make the reading easier as well. The problems I’ve noted in the post above is now gone. You can have the quote text qualifier in a CSV file and have comma’s in the fields.

15 AM

Hi, can the TextFileRead Split functionality be provided as a standalone string component that allows any text to be passed in as the input? no file read is then required