Check if variable CONTAINS a specific character?

Is there a command in choicescript for checking whether a variable contains something?

For instance if I had a variable with a value of “abcdef”, is there a way to check whether the variable contains the character “b”?

*if var CONTAINS “b”.

I haven’t been able to find anything on the ChoiceScript Wiki or here on the forums so I thought I would just ask. Thanks!

I don’t think so.

I believe you could make a loop and check the string char by char, but I haven’t actually tried.

Cslib is a collection of pluggable, ready to use subroutines. In the cslib_string module you have three subroutines that could help you achieve what you want: find, index and contains. Contains being the one that best fit your use case.

Example:

*create mystr "abcef"
*gosub_scene cslib_string contains mystr "b"
*if cslib_ret
  Contains b!

Thank you! This is exactly what I was after - I will try it out and let you know how it goes.