Jump to content
PeterPanettone

String Splitter

Recommended Posts

Posted (edited)

To avoid errors when the output is used in Delphi code, if the input string contains single quotation marks (#39), they should be replaced by two quotation marks (#39#39):

ThisString := TRegEx.Replace(ThisString, '(?:'')+', #39#39, [roIgnoreCase]);

(Please note that System.SysUtils.StringReplace cannot be used for this task, as it would replace quotation marks (#39) even in occurrences of two quotation marks (#39#39)!)

 

Hence, here is version 2:

 

StringSplitterversion2.zip

Edited by PeterPanettone

Share this post


Link to post
Posted (edited)

There was a bug in the regular expression that caused #39#39#39#39 and #39#39#39 to be transformed into #39#39

 

This bug is now fixed in version 3a:

 

StringSplitterversion3a.zip

 

image.thumb.png.4630b4fd0fbaf6f5da5a9e13a441efac.png

Edited by PeterPanettone

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×