logo hyperPad Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Login

    Combine text with variable without combine text behaviour

    Scheduled Pinned Locked Moved
    Comments & Feedback
    4
    7
    365
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • KamdroidK
      Kamdroid
      last edited by Kamdroid

      It would be a real time and behaviour saver if there was an option to e.g. use “{0}” and so on, in some text, and at runtime would convert it to the array item at the index, which would be specified in the set text.

      e.g. Set Label “Label1” to “Hello, {0}. The time is {1}. Today is {2}” using [GetAttr “username”, Get Time: Formatted time, Get Time: formatted date]

      1 Reply Last reply Reply Quote 0
      • T
        Thecheater887
        last edited by

        I don't understand why we can't just use the "Add Values" behavior.

        And before you attempt to explain, subtract would remove string B from string A if B is in A, multiply would output the text A repeated by number B, and divide values would take string B out of string A, and create an array containing the text on the left (0), string B (1), and the test on the right (2); if it isn't, just return string A in its own array for uniformity.

        Jack8680J KamdroidK 2 Replies Last reply Reply Quote 2
        • Jack8680J
          Jack8680 @Thecheater887
          last edited by

          @Thecheater887 this would work well with the calculator behaviour mentioned somewhere that would allow multiple maths operations in one behaviour.

          1 Reply Last reply Reply Quote 0
          • KamdroidK
            Kamdroid @Thecheater887
            last edited by Kamdroid

            @Thecheater887 If there was a “replace text with different text” behaviour that would contradict this idea, as I intended it so everything can be done using one behaviour, rather than multiple combine text or replace text behaviours

            My idea is from C#
            Console.WriteLine(“Hello there, {0}. Here’s information: {1}”, userName, someInformation);

            T D KamdroidK 3 Replies Last reply Reply Quote 0
            • T
              Thecheater887 @Kamdroid
              last edited by Thecheater887

              @Kamdroid I don't quite understand what the problem with

              Divide Values ("Hello Cruel World", "Cruel ")
              Add Values (Divide Values[0], "Wonderful ")
              Add Values1 (Add Values, Divide Values[2])

              For a result of "Hello Wonderful World" is.

              Yes, I'm aware I skipped the array logic, I haven't tampered with that yet, but I'm willing to bet it doesn't add much bulk.

              1 Reply Last reply Reply Quote 0
              • D
                Deeeds @Kamdroid
                last edited by

                @Kamdroid So far as I've seen, hyperPad doesn't superficially differentiate between text and numbers, doing that in the background, instead.

                So if you make a storage container of some sort that's got both numbers and text, they're all strings. I think.

                And this is kind of like making a dynamic language (not static) so that users don't need to worry themselves with what "type" of object they are storing with what other types.

                1 Reply Last reply Reply Quote 0
                • KamdroidK
                  Kamdroid @Kamdroid
                  last edited by

                  @Kamdroid said in Combine text with variable without combine text behaviour:

                  @Thecheater887 If there was a “replace text with different text” behaviour that would contradict this idea, as I intended it so everything can be done using one behaviour, rather than multiple combine text or replace text behaviours

                  @Thecheater887 With my idea, all text/word replacement can be done in one behaviour
                  Your idea makes it need multiple behaviours to achieve what I want. It’s still a good idea, but I think it shouldn’t replace my idea

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post