Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Stefan Kip 1614 posts 4131 karma points c-trib
    Dec 30, 2009 @ 17:39
    Stefan Kip
    0

    umbraco.library has LastIndexOf, not IndexOf?!

    Hi guys,

    Can anyone explain to me, why the umbraco library does contain a LastIndexOf method, but does not contain a IndexOf method?

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Dec 30, 2009 @ 18:07
    Douglas Robar
    0

    Interesting question!

    In my experience I am usually in a for-each loop and can simply check the position(). Would that work for you?

    Otherwise, maybe a quick little c# helper function in your xslt? For an example of how to do that, check out http://blog.percipientstudios.com/2009/9/21/advanced-xslt-with-net-namespaces.aspx

    cheers,
    doug.

     

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Dec 30, 2009 @ 18:39
    Stefan Kip
    0

    Doug,

    I'm not trying to solve anything for me ;-)
    LastIndexOf suits my needs in this case, but I was just wondering why IndexOf doesn't exist in the library...

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Jan 06, 2010 @ 19:14
    Stefan Kip
    0

    Bump ;-)

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Jan 06, 2010 @ 20:31
    Niels Hartvig
    0

    Because there's native support for this in xpath. It's called "substring-before" (http://www.zvon.org/xxl/XSLTreference/Output/function_substring-before.html).

    :)
    Niels...

Please Sign in or register to post replies

Write your reply to:

Draft