// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // // // // // int startsWith(string $s, string $prefix) // // // int : true if $s starts with $prefix // // // This procedure returns true if the string $s starts with // the string $prefix. // // // startsWith("abc", "ab"); // // Result: 1 // // // startsWith("abc", "bc"); // // Result: 0 // // // startsWith("abc", ""); // // Result: 1 // // // // // global proc int startsWith(string $s, string $prefix) { int $startsWith = false; int $sLength = size($s); int $prefixLength = size($prefix); if ($sLength >= $prefixLength) { if (startString($s, $prefixLength) == $prefix) { $startsWith = true; } } return $startsWith; }