'Get token' question (Solved)

This forum is currently in read-only mode.
  • How do i use 'Get token' to retrieve or isolate the end part of the following sentence -

    C:\Documents and Settings\brobs\My Documents\My Pictures\Photo.png

    So basically, i want (Photo.png)

    I need a way that works regardless the length...for example :

    C:\Documents and Settings\Photo.png   .....or

    C:\My Documents \Photo.png

    I know how to do when filling a list box,(using file object) but i can't

    work out this way.

    Thanks in advance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • for the same drive you can use "/Photo.jpg" or "\Photo.jpg"

  • for the same drive you can use "/Photo.jpg" or "\Photo.jpg"

    I don't understand what you mean?

    Sorry if im missing something obvious.<img src="smileys/smiley5.gif" border="0" align="middle" />

    Were would it fit in the following:

    GetToken(string, N [, delimiter])

    Returns the Nth token in string using delimiter. The default delimiter is comma (,) if you do not specify your

    own. Examples: GetToken("a,b,c", 2) gives "b", GetToken("one|two|three|four", 2, "|") gives "two"

  • There's "get token count" (NumTokens) expression. Use it to determine last index.

    Ex:

    GetToken(<string>, NumTokens(<string>, "\"), "\")

  • There's "get token count" (NumTokens) expression. Use it to determine last index.

    Ex:

    GetToken(<string>, NumTokens(<string>, "\"), "\")

    Thanks, it works.

    For:

    C:\Documents and Settings\brobs\My Documents\Construct1games\PHOTO.png

       + MouseKeyboard: On key Enter pressed

       -> Text2: Set text to GetToken(text1.Text, NumTokens(text1.Text, "\"), "\")

    Gives: PHOTO.png

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