Source language: Translate to:

TextEntry string count and expand

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

TextEntry string count and expand

Postby Dudus » Sat Sep 30, 2017 1:44 pm

Hi,

i have a Text Entry with 20 char place, I need to count the entered words and if the word is less than 20 char for example only 5 char
than word+15char with space like this:

Yesss_______________ (ofcourse _ now is space)

How to do that?
Thanks!
Dudus
User avatar
Dudus
 
Posts: 114
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: TextEntry string count and expand

Postby Gaev » Sat Sep 30, 2017 6:36 pm

Dudus:

Try this ...
Code: Select all
... append with spaces to make length of 20 characters
... assumes that string will always be <= 20

... calculate required spaces
StrLen "[TextEntry20]" "[TextEntry20Len]"
Math "20-[TextEntry20Len]" "0" "[RequiredSpaces]"

... make string of required spaces
SetVar "[TwentySpaces]" "                    "
...SetVar "[TwentySpaces]" "12345678901234567890"
SubStr "[TwentySpaces]" "1" "[RequiredSpaces]" "[RequiredSpacesText]"

... append
SetVar "[RequiredText]" "[TextEntry20][RequiredSpacesText]"

... verify
StrLen "[RequiredText]" "[RequiredTextLen]"
AlertBox "Results" "[TextEntry20Len] ... [RequiredSpaces] ... [RequiredTextLen] ... <[RequiredText]>"
User avatar
Gaev
 
Posts: 3736
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: TextEntry string count and expand

Postby Dudus » Sun Oct 01, 2017 10:24 am

Hello Gave!

Works perfect... :) Thank you verry much!

Dudus
User avatar
Dudus
 
Posts: 114
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest


Return to NeoBook Action Commands

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests