« MBS FileMaker Plugin,… | Home | Select Internet Explo… »

Split and Join strings

Splitting and joining string arrays is a common operation in Xojo projects. Beside the built-in Join and Split functions, we do have a couple of alternatives, optimized in their way.

First we have Split:

SplitMBS(value as String, delimiter as String = " ") as String()

This takes the string and if it is unicode convert it to UTF-8 and split it. If delimiter is nil, splits into an array of letters.
If encoding is different, we split it and keep the original encoding.

For joining, we have 5 alternatives:

JoinStringMBS(strings() as string) as string
JoinStringMBS(values() as variant) as string
JoinDataMBS(values() as variant) as string
JoinDataMBS(strings() as string) as string
JoinDataMBS(blocks() as memoryblock) as string

So we can join Strings as well as MemoryBlocks. As convenience we can also join arrays of variant with them mixed. JoinDataMBS joins data, so all the bytes are just added up ignoring any encoding. JoinStringMBS converts first all to UTF-8 and returns the text back as UTF-8.

Please try them. SplitMBS is in 16.4pr8.
20 09 16 - 10:45
No comments

Remember personal info?

Emoticons / Textile

Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.