// =========================================================================== // 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 endsWith(string $s, string $suffix) // // // int : true if $s ends with $suffix // // // This procedure returns true if the string $s ends with // the string $suffix. // // // endsWith("abc", "bc"); // // Result: 1 // // // endsWith("abc", "ab"); // // Result: 0 // // // endsWith("abc", ""); // // Result: 1 // // // // // global proc int endsWith(string $s, string $suffix) { int $endsWith = false; int $sLength = size($s); int $suffixLength = size($suffix); if ($sLength >= $suffixLength) { if (endString($s, $suffixLength) == $suffix) { $endsWith = true; } } return $endsWith; }