-- Slawomir wrote:
> I would like to suggest two new string functions (should be pretty
> easy to implement):
> startswith("abcde","abc") == true
> startswith("abcde","cde") == false
> and
> endswith("abcde","abc") == false
> endswith("abcde","cde") == true
> I know those can be simulated by using select(), but it isn't as
> elegant as I would like it to be :D
By coding your script in this fashion, you can already achieve
something very close to what you want. Try running this script for an
example:
-- MyScript.PowerPro
Win.Debug([EMAIL PROTECTED]("abcde", "abc")) ;; true
Win.Debug([EMAIL PROTECTED]("abcde", "cde")) ;; false
Win.Debug([EMAIL PROTECTED]("abcde", "abc")) ;; true
Win.Debug([EMAIL PROTECTED]("abcde", "cde")) ;; false
Quit ;; this line is important to have before the next lines
@StartsWith
Quit(Index(Arg(1), Arg(2)) == 1)
@EndsWith
Local Arg2Loc = RevIndex(Arg(1), Arg(2))
; -- all on one line below
Quit(IfElse(Arg2Loc, Arg2Loc == (Length(Arg(1)) - Length(Arg(2)) + 1), 0))
; -- all on one line above
--
Alex Peters / Melbourne, Australia
PowerPro v4.2.00 / Windows XP
Attention: PowerPro's Web site has moved: http://www.ppro.org
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/power-pro/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/