Skip to content

A minimal lua function to add split functionality

License

Notifications You must be signed in to change notification settings

TaizWeb/split-lua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

split.lua

This is a simple function that returns a table of a string split at a delimiter. This words identically to Python's split function.

Installation

You can copy the entirety of this file into your project, or you can simply do

require("split")

Assuming the file split.lua is in the same directory.

Usage

The function assumes a string and a delimiter to split it by

require("split")
splitString = split("This is a test sentence", " ")
print(splitString[2]) -- Prints 'is' to the console
-- Delimiters can also more than one character
splitString = split("This<>is<>a<>test<>sentence", "<>")
print(splitString[2]) -- Also prints 'is' to the console

License

This function is released under the MIT License. See LICENSE.md for more details.

About

A minimal lua function to add split functionality

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages