OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: lizardx on 04 Jun 2004, 13:12:53

Title: Checking "inside" the strings
Post by: lizardx on 04 Jun 2004, 13:12:53
Sorry if I wasn't correct enough in the subject, my English is rather poor...
Is there a way to check wheter a specific character chain is in a string?
Example:
variable1= "blablaABCblabla"
variable2="blablaDEFblabla"
the characters I'm looking for: "ABC"

what I want: a script, a function, whatever will work like this

["ABC",variable1,variable2] exec/call "WHATIWANT.sqs/sqf"

and it results

"true", "false"

Simple request, isn't it? Thx in advance!
Title: Re:Checking "inside" the strings
Post by: Jezuro on 06 Jun 2004, 20:08:33
Sorry, but I must say I think it's not possible  :P
You cannot check the characters in words (strings), eg

? "MyBigGun" in "ThisIsMyBigGun" : hint "It's there!"

The OFP engine lets you only search the values in arrays:

? "G" in ["G","u","n"] : hint "The word -GUN- has a -G- character!"