¿ªÔÆÌåÓý

Re: Trailing Comma


 

¿ªÔÆÌåÓý

Nice,

?

Has anyone culminated all these tricks and tips into a document?

?

Scott

?

?

From: [email protected] <[email protected]> On Behalf Of Bruce Gulke
Sent: Friday, April 3, 2020 11:41
To: [email protected]
Subject: Re: [TableSmith] Trailing Comma

?

Yet another way to do it would be to use "length" and "left" to strip off the last character, which in this case would always be a comma. Something like this:

?

|lang=[GenLanguages]|

_|len=Length{%lang%}-1|

_|lang=Left{%len%,%lang%}|

?

?

On Fri, Apr 3, 2020 at 11:23 AM Bo <lorgryt@...> wrote:

Cool, thanks for stepping up Erol.

?

On Fri, Apr 3, 2020 at 9:22 AM ErolB1 via <ErolB1=[email protected]> wrote:

You need to treat either the first or last language as a special case,
in one way or another. One possibility:

_|numLang={Dice~1d6}| {Bold~I speak %numLang% Languages: }
_[Culture.Language]{Loop~{Calc~%numLang%-1},, [Culture.Language]}{CR~}

This produces the first language, with any additional languages then
being added as (comma space LanguageName)

A remaining flaw is that you can get "I speak 1 languages:..."
So for additional cleanup you need to use the PluralIf function.

Erol K. Bayburt
ErolB1@...

On 4/3/2020 10:30 AM, scott@... wrote:
> Hey folks,
>
>? ?????????????? I have been TSing, and I think this question was
> answered prior, but I could not find it.
>
> I roll for a random # of languages then pull from the list. In the
> string layout, I put a comma in there; it prints after each item. Is
> there another way to do this, so you don¡¯t end with a trailing comma?
>
> _|numLang={Dice~1d6}| {Bold~I speak %numLang% Languages:}
> {Loop~%numLang%,[Culture.Language], }{CR~}
>
> *I speak 3 Languages:* Common, Dwarf, Elf,
>
> Scott
>
>


Join [email protected] to automatically receive all group messages.