Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    You're using -strpos()- incorrectly. You can't provide a list of things to match on in the second argument like that. -strpos()- will think you want to match strings with all of them present.

    So you have to write out a long list of -strpos()- functions, with one genre each, connected by disjunction (|). Since your list is pretty long, that's tedious. A simpler way is this:

    Code:
    gen byte is_other = 0
    local other_list Animation Biography Crime Documentary Family Fantasy ///
        History Horror Music Musical Mystery SciFi Sport War Western
    foreach o of local other_list {
        replace is_other = 1 if strpos(all_genres, `"`o'"')
    }
    Notes:

    1. Not tested. Beware of typos.
    2. The syntax for the -local other_list- statement relies on the values of genre listed not containing any embedded blanks. If that is not correct, you must put quotes around any that do.

    Comment

    Working...
    X