Skip to content

[LG] Need a way to iterate strings #3279

@mdrichardson

Description

@mdrichardson

Is your feature request related to a problem? Please describe.

Currently, there is no way to iterate over a string using Language Generation / Common Expression Language. This issue spawns from a StackOverflow question. Basically, they want to be able to pull numbers out of strings, such that:

  • "hey 1234" becomes "1234"
  • "xyz1234" becomes "1234"

Describe the solution you'd like

Ideally, array() could turn a string into an array, so that it can be iterated over.

Describe alternatives you've considered

Alternatively, split(<string>, <delimiter>) could accept a null or wildcard delimiter, which would just split every character. It looks like that may have been considered.

Additional context

In my own testing, with var test = "hey, 1234",

  • array(test) = [ 'hey, 1234' ]
  • createArray(test) = [ 'hey, 1234' ]
  • split(test, null) = [ 'hey,' '1234']
  • split(test, "") = [ 'hey,' '1234']
  • split(test, string.Empty) = [ 'hey,' '1234']

[enhancement]

Metadata

Metadata

Labels

R8Release 8 - March 16th, 2020

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions