+ Reply to Thread
Results 1 to 4 of 4

Thread: Padding variables with spaces/blanks

  1. #1

    Question Padding variables with spaces/blanks

    I have searched through the forum and not found anything on this SetupBuilder scripting topic, so here's the question I'm posing.
    Is it possible to pad a character string with trailing spaces or blanks? From how I've seen SetupBuilder scripting act, it seems that if there are trailing spaces/blanks in a variable, it truncates them automatically when doing any kind of operation with the variabe, and there doesn't seem to be anything you can do to keep the trailing space(s) in the variable. For example, in this following SetupBuilder script code, I set the values of the first two variables to have a trailing space . . .

    Set Variable %OUTPUT_FIELD1% to "SetupBuilder "
    Set Variable %OUTPUT_FIELD2% to "is "
    Set Variable %OUTPUT_FIELD3% to "awsome!"

    Set Variable %OUTPUT_LINE% to %OUTPUT_FIELD1%%OUTPUT_FIELD2%%OUTPUT_FIELD3%

    I would expect the content of the %OUTPUT_LINE% variable to have a value of (excluding the quotes) "SetupBuilder is awesome!" . . . but it's doesn't.
    Because SetupBuilder is truncating the trailing spaces when it evaluates them and performs an operation on them, the value ends up being "SetupBuilderisawesome!"


    If I were to using the same example, only with leading blanks instead of trailing blanks, the results are different. SetupBuilder will keep leading blanks when doing the operations.


    Set Variable %OUTPUT_FIELD1% to "SetupBuilder"
    Set Variable %OUTPUT_FIELD2% to " is"
    Set Variable %OUTPUT_FIELD3% to " awesome!"

    Set Variable %OUTPUT_LINE% to %OUTPUT_FIELD1%%%OUTPUT_FIELD2%%OUTPUT_FIELD3%

    In the above case, the value of %OUTPUT_LINE% will be "SetupBuilder is awesome!" . . . keeping the leading spaces.

    So, my question is why does SetupBuilder seem to automatically truncate trailing spaces when doing operations on character strings, and how can you circumvent that (if possible)?

  2. #2
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Padding variables with spaces/blanks

    Hi Jerry,

    Good question. I'll have to play with it and get back to you!

    Friedrich

  3. #3

    Default Re: Padding variables with spaces/blanks

    Hey, Friedrich, it's been about 3 weeks now. Any word on this yet?

  4. #4
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Padding variables with spaces/blanks

    Hi Jerry,

    in the current SB version it always truncates trailing spaces. In earlier versions of SB, it truncated both leading and trailing spaces. We are experimenting right now in SB 2023 how to change this behavior. But in the current version it is definitely not possible!

    Friedrich

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •