Combine text with variable without combine text behaviour



  • 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]



  • 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.



  • @Thecheater887 this would work well with the calculator behaviour mentioned somewhere that would allow multiple maths operations in one 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

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



  • @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.



  • @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.



  • @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


Log in to reply
 

Looks like your connection to hyperPad Forum was lost, please wait while we try to reconnect.