i'm looking for something in the like of strpos in most languages (strstr in C).
Basicly, i want to check if a string contain a substring. I could not find any character by character access either. I had a look through the xsd, but had no luck finding anything that may help me (altho i missed some other things in the past)
[ stupid mod question ] is there a string search functionality available ?
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 259
- Joined: Sat, 23. Nov 13, 09:48
-
- Posts: 83
- Joined: Sun, 22. Aug 10, 13:55
Hello Jey123456,
This might help you:
list / indexof.{$value} / integer / "Index of first occurrence of $value in the list (1-based), or 0 if not found"
Example:
Is it what you're looking for?
Regards,
ybeline
This might help you:
list / indexof.{$value} / integer / "Index of first occurrence of $value in the list (1-based), or 0 if not found"
Example:
Code: Select all
$test_list=[5,2,7,4]
$test_list.indexof.{7}='3'
Is it what you're looking for?
Regards,
ybeline
-
- Posts: 259
- Joined: Sat, 23. Nov 13, 09:48
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
<substitute_text source="$string1" text="$string2"><replace string="'cool'" with="''"/></substitute_text>
and compare $string1 with $string2 - if they are the same it is not in ther, if they differ it is in there.
and compare $string1 with $string2 - if they are the same it is not in ther, if they differ it is in there.
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help

-
- Posts: 75
- Joined: Tue, 26. Nov 13, 10:07
..wowUniTrader wrote:<substitute_text source="$string1" text="$string2"><replace string="'cool'" with="''"/></substitute_text>
and compare $string1 with $string2 - if they are the same it is not in ther, if they differ it is in there.
I must say this xml scripting is genius from a modding perspective but it sure doesnt make mundane tasks easier xD
Streaming while writing mods: twitch.tv/fumblesneeze
-
- Posts: 259
- Joined: Sat, 23. Nov 13, 09:48
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
i know its more a workaround and i would almost bet there is a cleaner way, but this one is the only one i know atm (i think there is an operator for expressions which achives the same or better(string position), but without doc its impossible to find it)
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
