Length of variable

Post Reply
User avatar
JimmyHartington
Advanced member
Posts: 365
Joined: Tue Mar 22, 2011 7:38 am

Length of variable

Post by JimmyHartington »

I can not seem to find out how to get the length (number of characters) of a variable.
Is there a built in way in Switch to do this?
Or do I have to use scripting?
freddyp
Advanced member
Posts: 1078
Joined: Thu Feb 09, 2012 3:53 pm

Re: Length of variable

Post by freddyp »

I am interested in hearing what the use case is.

If the number of possibilities is limited you could create a condition with variables where you match the variable with .{3} for three characters etc. On the outgoing connection folder you can then set private data with the number.
User avatar
JimmyHartington
Advanced member
Posts: 365
Joined: Tue Mar 22, 2011 7:38 am

Re: Length of variable

Post by JimmyHartington »

I have an action list, which places a string (variable from Switch) onto the first page.
If the number of characters of the string is larger than 90 I would like to set the font size to another value.
And since Loic Agnon showed the conditional variables in Pitstop I would like to use them to set the font size dynamically.

But since thinking about it I have another way in this case to achieve what I want.
After I add the text I select all text with which overlaps the media box and scales it down to a specific width in mm.
User avatar
magnussandstrom
Advanced member
Posts: 447
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

Re: Length of variable

Post by magnussandstrom »

I have done a similar thing, similiar to Freddys idea. Maybe this helps:
flow_90.png
flow_90.png (28.76 KiB) Viewed 8084 times
regex_90.png
regex_90.png (14.9 KiB) Viewed 8084 times
User avatar
JimmyHartington
Advanced member
Posts: 365
Joined: Tue Mar 22, 2011 7:38 am

Re: Length of variable

Post by JimmyHartington »

Thanks Magnus for the example.
In my current use case I will use the other idea with scaling the content, which overlaps the media box.
Post Reply