How do I edit a random string

0 favourites
  • 4 posts
From the Asset Store
This collection of music is the beautiful performance of rather small strings ensemble (8 first violins, 6 second violin
  • Hi everyone,

    I have an array full of string objects. My code chooses one of those objects and then writes it to a global variable.

    The catch is, each string has extra characters that I don't want.

    For example,

    in 0,0 the string is A.object

    in 0,1 the string is B.object

    ect

    How can I remove the "object" part of the string before writing it to the global variable (The result is ends up being just the initial letter in the global variable). Is it even possible?

    Thanks!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Maybe set the variable using the 'Left' expression?

  • Maybe set the variable using the 'Left' expression?

    Hi Zenox98,

    not exactly what I was expecting but I can make it work!

    Thank you very much for your help .

  • TMAJA using Left would require knowing how many characters to the left of the decimal you have (which may work fine if you are just working with the alphabet or know you will only have one digit names). If your string objects potentially have names longer than one digit, then you could use TokenAt

    eg: global variable = TokenAt(string,0,".")

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)