Skip to content

Variables in Switch-Case #720

Answered by ivanhofer
jnsprnw asked this question in Q&A
Aug 7, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hi, thanks for your kind words :)

No, this is currently not possible.

It is not the prettiest code, but you could do it like this:

const text = 'I’m {age:number} years old {appendix:string}'
const textAppendix = 'from {region}'
const region = 'Asia'
const str = LLL(text, { age: 11, appendix: region ? LLL(textAppendix, { region }) : '' }).trim()

Do you really use the raw LLL function with plain strings instead of the LL function with an dictionary object?

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jnsprnw
Comment options

Answer selected by jnsprnw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants