Copied to clipboard

Flag this post as spam?

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


  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 16, 2013 @ 12:57
    Fuji Kusaka
    0

    Splitting a Word or NodeName

    Can anyone point out how do i split a nodename or a textString to achieve something like this in html.

    <strong>First</strong> Second

    So after the first Space between a NodeName or any entry in a TextString I add a <Strong> Tag around the first word.

    If my nodeName is called First Node in html i should render <strong>First</strong> Node likewise in a textstring.

    Any idea please?

     

  • Jeavon Leopold 3008 posts 13221 karma points MVP 7x admin c-trib
    Jul 16, 2013 @ 13:38
    Jeavon Leopold
    100

    How about?

        var nodeName = "First Node";
        var pos = nodeName.IndexOf(' ');
        if (pos != -1)
        {
            <strong>@nodeName.Substring(0,pos)</strong>@nodeName.Substring(pos,nodeName.Length-pos)
        }

    Jeavon

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 16, 2013 @ 14:28
    Fuji Kusaka
    0

    Hi Jeavon,

    Thanks for the reply, yes this is what i was looking for.

    Here is the final solution,

    var nodeName = CurrentModel.Name;
    var pos = nodeName.IndexOf(' ');

    //fuji

  • Jeavon Leopold 3008 posts 13221 karma points MVP 7x admin c-trib
    Jul 16, 2013 @ 15:38
    Jeavon Leopold
    0

    Hi Fuji,

    That's great! Glad to have helped!

    Thanks,

    Jeavon

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies