count character in a text

Moderator: Moderator Group

count character in a text

Postby sune » Tue Dec 06, 2016 3:21 pm

hey i really need help.
I need to count character in a text. Does anyone have an idea? how to do it.
Thought there was a character count node, but there is no.

hope someone has an idea
Sune Munk Schou
Lighting- and Video Technician
tlf: +45 31 58 54 41
mail: sune@stouenborg.dk
web: stouenborg.dk
User avatar
sune
 
Posts: 37
Joined: Mon Sep 12, 2011 8:16 am
Location: Danmark

Re: count character in a text

Postby chrisr » Tue Dec 06, 2016 8:45 pm

Sune, is there a max count it could be. For instance, 0-100 characters? Is there an infinite number possibly? Do you need the spaces between the characters counted?
Thank You

ChrisR
SurfacePro3 - 2GHz i5 - 4GB ram - Windows 10 Pro - WD Pro 4.7 Rev2500 and WD v6
Sager Laptop - Intel 2.4GHz i7 3630QM - 16GB ram - Windows 7 Pro Svc Pack1 - Offline Manager v6
chrisr
 
Posts: 143
Joined: Tue Jan 26, 2016 10:50 pm

Re: count character in a text

Postby sune » Wed Dec 07, 2016 7:39 pm

I need to know how many character I have in a live text input, so I can adjust the text size to fill the full screen
Sune Munk Schou
Lighting- and Video Technician
tlf: +45 31 58 54 41
mail: sune@stouenborg.dk
web: stouenborg.dk
User avatar
sune
 
Posts: 37
Joined: Mon Sep 12, 2011 8:16 am
Location: Danmark

Re: count character in a text

Postby justyn roy » Wed Dec 07, 2016 10:30 pm

Hi Sune,

There is not a Node that can do this, you're right, but there is a script:

VGetStringLength,VarName,String

You can assign your input to a variable with a Node then use this script to count that variable.

I hope this helps.

Justyn
Justyn Roy

Online Manual
User avatar
justyn roy
 
Posts: 132
Joined: Tue Sep 27, 2016 1:26 am

Re: count character in a text

Postby justyn roy » Thu Dec 08, 2016 4:52 pm

You can write Danish characters Æ Ø Å in the text input box in wd, but they come out as "<?>" PB text layer. can I get around it? so I can write the Danish characters

_________________________________________________________________________________________________________________________________________________


To get 'special characters' from the Widget Designer into Pandoras Box, you can use the "PB Text Unicode" Node.

I just tested this node with your characters and they worked.
Justyn Roy

Online Manual
User avatar
justyn roy
 
Posts: 132
Joined: Tue Sep 27, 2016 1:26 am

Re: count character in a text

Postby chrisr » Thu Dec 08, 2016 7:46 pm

Justyn,
I have a question. Where is the answer deposited? If the text read "Hello World" that would be 11 characters. I assume if you run the Script, you would end up with an answer of 11, just foggy on where that answer would show itself.

VGetStringLength,VarName,String VarName is the text you want to count, correct? Or is it where the answer of the script is placed. So if Text inside textbox1 how would this script be formulated assuming VarName is the variable

VGetStringLength,VarName,Textbox1 ?

Thanks!
Thank You

ChrisR
SurfacePro3 - 2GHz i5 - 4GB ram - Windows 10 Pro - WD Pro 4.7 Rev2500 and WD v6
Sager Laptop - Intel 2.4GHz i7 3630QM - 16GB ram - Windows 7 Pro Svc Pack1 - Offline Manager v6
chrisr
 
Posts: 143
Joined: Tue Jan 26, 2016 10:50 pm

Re: count character in a text

Postby justyn roy » Thu Dec 08, 2016 8:48 pm

The return is written to what ever Variable you would like - it's written as an Integer.
You can get the value from anywhere in WD - a String Variable or right from a Text Box if you'd like.
Just replace "string" with what ever you'd like to count.
For example:

Code: Select all
VGetStringLength,Length,textbox1.text


This will write an Integer with the number of characters (including spaces) to the Variable "Length" from Textbox 1.
Justyn Roy

Online Manual
User avatar
justyn roy
 
Posts: 132
Joined: Tue Sep 27, 2016 1:26 am

Re: count character in a text

Postby chrisr » Thu Dec 08, 2016 8:52 pm

I tried a few different things..... forgot to put the .text after the textbox1.... Opps. Thanks for the clarification!!
Thank You

ChrisR
SurfacePro3 - 2GHz i5 - 4GB ram - Windows 10 Pro - WD Pro 4.7 Rev2500 and WD v6
Sager Laptop - Intel 2.4GHz i7 3630QM - 16GB ram - Windows 7 Pro Svc Pack1 - Offline Manager v6
chrisr
 
Posts: 143
Joined: Tue Jan 26, 2016 10:50 pm


Return to Widget Designer V4.7

Who is online

Users browsing this forum: No registered users and 24 guests

cron