Android Question [Solved] What function is similar to SplitGetWord in the StringFunctions lib?


Well-Known Member
Licensed User
There are the library StringFunctions:

and there are this observation of Erel:
A relatively popular library named StringFunctions is available. It was written by @margret.
I don't recommend using it as it is not maintained and all its features are already available in the core library.

The SplitGetWord returns just the one element selected with GetElement from the string.
ANS = SF.SplitGetWord("This is a test string.", " ", 2)
In this example the function will Return: "is"

How I can do this using the feature of the core library?

Thanks in advance for any tips.


Licensed User
This sub does what you want.
The difference is that the index begins with 0 not with 1 like in your example.
To get 'is', you should use ANS = SplitGetWord("This is a test string.", " ", 1)

Sub SplitGetWord(txt As String, SplitCharacter As String, Index As Int) As String
    Private words() As String
    words = Regex.Split(SplitCharacter, txt)
    Return words(Index)
End Sub