Graphics

 View Only
  • 1.  pick a word from a sentence

    Posted 07-24-2013 20:32
    Hi, im doing a Weather Channel Forecast animation, but the client wont send me specific words like "rain" or "sunny", etc so I can assign them to a material, so Im doing the following

    Example:

    input text by client: "rainy day following by a hurricane"

    If InStr(text_IN.text, "rainy d")

    image_IN.text = "rain"

    that way its easy to assing the rain to a png.

    but.. the problem is as follows : the client usually starts his sentence with "sunny day at the morning, afterwards rain"

    so I want to know if there is a way to search for specific words, like this

    if ((search in string "rain"))

    image_IN.text = "rain"

    if ((search in string "cloudy"))

    image_IN.text = "meatballs"

    Hi. is there a way to pick a specific word?


  • 2.  RE: pick a word from a sentence

    Posted 07-24-2013 20:37
    Hi Luis.. I don't really understand what you are asking..

    It sounds like you already know how the InStr() function works; but it's the second part of your question I don't understand.

    #XPression


  • 3.  RE: pick a word from a sentence

    Posted 07-24-2013 20:52
    let me try something and if it doesnt work I will pasty my code.

    #XPression


  • 4.  RE: pick a word from a sentence

    Posted 07-24-2013 21:19
    I want the program to look for a specific word within a sentence and pull out the whole phrase. (so I can just type said word on my code)

    the problem I am having withg InStr(), is that when looking said word in that phrase, it starts looking from the first word and it doesn't find any word at the middle or end of the sentence..

    let me give you an example:

    "an apple at noon"

    "an apple at night"

    "an apple a day wont take the doctor away"

    If from the choices given, I want the last sentence, I have to write the code as follow:

    InStr(text_in.text, "an apple a d"), because if I write InStr(text_in.text, "day"), it wont find the phrase.

    I want to look just for the word "day" within the phrase.

    #XPression


  • 5.  RE: pick a word from a sentence

    Posted 07-25-2013 03:56
    InStr should pick out a word from any location in the sentance, but it all depends on your script. Can you post your actual script?

    For example, if you had:

    if InStr(text, "day") = 1 then this would only find the word "day" if it were the first word in the sentance,

    but if InStr(text, "day")>0 should find it anywhere in the sentance..

    If you post your script it will be easier for us to help you.

    #XPression


  • 6.  RE: pick a word from a sentence

    Posted 07-25-2013 07:04
    Ohhh im using equal one... Im at my house, tomorrow at work ill test it, but im sure it will work

    #XPression