You are not logged in.
Pages: 1
/// args( str, substr, pos );
//
// Checks the given string for a substring at the given position.
// Example: if (args(str, "str", 1)) show_message("yes");
//
// str the string to check in, STRING
// substr the substring to check in the string, STRING
// pos the position to check at in the string, INT
//
// What differs this script from the built-in "string_pos" function,
// is that this function can check for a string at any position and not just the first occurrence.
//
/// GMLscripts.com/license
{
var eStr = string( argument1 ); // string to check in
var eStart = real( argument2 ); // position to check at
var eCheck = string_lower( argument0 ); // lowercase in string
var ii = 0; // temp variable to check if we should return true
for ( var i = 0; i < string_length( eStr ); i++ ) {
if ( string_char_at( eStr, 1 + i ) == string_char_at( eCheck, eStart + i ) ) // check if characters match
ii++; // add to temp variable
}
if ( ii = string_length( eStr ) ) return true; // return true if temp variable is equal to string length
return false; // or return false
}
Last edited by nmejames (2016-04-03 15:27:22)
Offline
Pages: 1