how long is a piece of string

smurftedsmurfted Member, PRO Posts: 570

If i have a text string (attribute or a table entry), is it possible to make it one character shorter.

So for example "blob" would become "blo"..

Comments

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited June 2016

    Try using the following functions:

    textLength (Function): This returns the length of the text or numerical attribute

    textSubStr (Function): This returns a text which is the substring of attribute, text, starting from index startIndex and ending at index endIndex.
    Usage: Given a text attribute with the value “the quick sly fox jumped over the lazy dog.”
    textSubStr(self.Text ,5,8) returns the value “quic”. You can also use this to extract a random set of numbers from a string and use that as a way to choose a unique question via table row number.

    http://help.gamesalad.com/gamesalad-cookbook/1-getting-started/1-11-glossary/

    So it would be something like this: textSubStr(self.Text, 1, textLength(self.Text) - 1)

  • smurftedsmurfted Member, PRO Posts: 570

    works like a dream, you sir are epic..

Sign In or Register to comment.