User Tag List

Results 1 to 5 of 5

Thread: String Parser: advanced use

  1. #1
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleUnicode Add-on
    Boba Fonts's Avatar
    Join Date
    Jan 2009
    Location
    Northern Italy
    Posts
    228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    String Parser: advanced use

    I'm playing with the String Parser 2 by 3EE and I've no problem doing basic things such as setting delimiters, retrieving tokens, positions in list, etc.
    Now I wonder if it's possible to use delimiters contextually, to have a certain character or string -say, the blank space- acting as a delimiter but not -say- when between brackets.
    This could be particulary useful to get a phrase as a single token such as follows:

    CharacterName say (I can't go that way)

    ( ) = always delimiters
    blank space = delimiter if NOT between ()

    so that I can get:
    token 1 = CharacterName
    token 2 = say
    token 3 = I can't go that way

    Is it possible? Thanks

  2. #2
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Simon's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    2,735
    Mentioned
    65 Post(s)
    Tagged
    3 Thread(s)
    Did you have a specific reason to want the spaces to have two different meanings as tokens/not? Depending on what are trying to do, I can think of a few solutions...

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleUnicode Add-on
    Boba Fonts's Avatar
    Join Date
    Jan 2009
    Location
    Northern Italy
    Posts
    228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The only reason is to have a more readable script.

  4. #4
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Simon's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    2,735
    Mentioned
    65 Post(s)
    Tagged
    3 Thread(s)
    Well there are few ways to achieve this that I can see, but they all involve extra parsing of the strings by hand and I personally wouldn't recommend it. My suggestion would be to use the String Tokenizer object. This can support 2D tokens so you could have this:

    CharacterName/say/I can't go that way#CharacterName2/say/We can't go that way

    This would allow you to return a 2D array, using "#" as the X delimiter and "/" as the Y delimiter. The array would contain the following data:

    {X:0} [CharacterName] [say] [I can't go that way]
    {X:1} [CharacterName2] [say] [We can't go that way]

    The array is all internal to the string tokenizer object, you just access the data by asking for an X and Y position using the provided expression. It's obviously not human readable as you asked, it's just how I'd do it to be efficient.


    I suppose the easiest way to achieve exactly what you're after is:

    take string: "CharacterName say (I can't go that way)"

    tokenize it using "(", giving you -> "CharacterName say" & "I can't go that way)"

    store the second token in a string variable somewhere using: left$(thestring, len(thestring)-1) which will strip off the ")" left at the end of it

    then, tokenize the first token ("CharacterName say") using a space character, which will give you "CharacterName" and "say"


    You could maybe use regular expressions (regexp) to directly return specific portions of the string too. There is a Regular Expressions object and maybe another I can't remember right now. http://www.regular-expressions.info/tutorial.html here's a tutorial on how to use regular expressions.

    Good luck!

  5. #5
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleUnicode Add-on
    Boba Fonts's Avatar
    Join Date
    Jan 2009
    Location
    Northern Italy
    Posts
    228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think the best method for me right now is the two-steps tokenization with "(".
    Thank you for your time, Simon!

Similar Threads

  1. String splitting with string parser
    By Sejez in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 5th February 2013, 05:31 AM
  2. Using String Parser to check for any punctuation in a string
    By Apex in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 18th May 2012, 11:03 PM
  3. String Parser or String Parser 2? Vitalized
    By DJ_Wild in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 5th September 2009, 10:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •