Mark,

Thanks- that seams a reasonable solution for sizing small fields.

What maths library would you be thinking of me using? 

I Know about Evans Formula plugin and remember a calc widget somewhere.

Regards
Tony

On Thursday, June 6, 2019 at 2:26:10 PM UTC+10, Mark S. wrote:
>
> You'll either need a math library, or upgrade to 5.1.20.
>
> But here's a way for strings that are 50 characters or less:
>
> \define length2(str,len)
> <$vars reg="^.{$len$}$">
> <$set name="result" filter="[title[$str$]regexp<reg>]" value="""$len$""" 
> emptyValue="" >
> <<result>>
> </$set>
> </$vars>
> \end
> \define length(str)
> <$list filter="[range[1,50]]" variable="cnt">
> <$macrocall $name="length2" str="""$str$""" len=<<cnt>>/>
> </$list>
> \end
>
> Length: <<length "How long am I">>
>
>
> You can, of course, extend it to possible longer numbers. But it's not 
> very efficient (it will check every possible length between 1 and 50 even 
> AFTER it has found the correct length).
>
> Mark
>
> On Wednesday, June 5, 2019 at 6:16:52 PM UTC-7, TonyM wrote:
>>
>> Bump,
>>
>> Is there a way to obtain the length of a string?
>>
>> It appears to be coming in 5.1.20 but before ?
>>
>> For example if there was a length operator I could do this 
>> {{{ [length{!!caption}] }}}
>>
>> Placing it in the size= parameter of edit-text widget would be great.
>>
>> Regards
>> Tony
>>
>>
>> On Thursday, May 30, 2019 at 10:27:29 AM UTC+10, TonyM wrote:
>>>
>>> Hi,
>>>
>>> I am using the edit-text widget to edit fields. I am using tag=input and 
>>> it is possible to set the size of the field in number of characters. The 
>>> default is 20 (HTML doco)
>>>
>>> However I would like this size to be set to the length of the value 
>>> contained in the field, or ideally only if it is greater than already set.
>>>
>>> Does anyone know how to do this please?
>>>
>>> Tony
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/5145cf4c-bc80-4d74-a393-420d9df59b6a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to