Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
L ldpl
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 8
    • Issues 8
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Lartu
  • ldpl
  • Merge requests
  • !94

Merged
Created May 13, 2019 by Lartu@lartu🐕Maintainer

SPLIT text statement

  • Overview 4
  • Commits 1
  • Changes 3

Created by: dvkt

This is much nicer than #93. This patch implements the SPLIT statement that was already listed as a TODO in the source. It lets you easily just split a string or file into a vector and loop over that, and avoids all the caching nonsense.

DATA:
words is text vector
PROCEDURE:
SPLIT "hi there" BY " " IN words
DISPLAY words:1 crlf

output:

there

If you want to get all the characters, you can split by "":

SPLIT "hi there" BY "" IN letters
DISPLAY letters:1 crlf

output:

i

And of course, the whole point - it works with utf8:

split "🐈 say meow, 🐕 say woof" by "" in letters
display letters:0 crlf
display letters:6 letters:7 letters:8 letters:9 crlf
display letters:12 crlf

output:

🐈
meow
🐕
Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: github/fork/dvkt/split