problem with tags

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • miladhatam@gmail.com

    #1

    problem with tags

    hi friends
    i've built a page that should show first 150 chars of every of my
    topics but when i wanted to do this work with SubString() it included
    the tags of my field of my db and very bad viewing happend
    i want to retrieve rendered text without any tag ...
    please help me ...
  • Jonathan Wood

    #2
    Re: problem with tags

    Sounds like there's a problem with your code, but you didn't include your
    code, or any details about what you are doing beyond using SubString() so I
    really don't see how anyone can help you.

    Perhaps you should show, or at least describe, just what you are doing.

    Beyond that, you can set a break point at look at the string being passed to
    Substring and your arguments and you should be able to see why it returns
    what it does.

    --
    Jonathan Wood
    SoftCircuits Programming


    <miladhatam@gma il.comwrote in message
    news:d609e7fb-4088-4381-a255-950d0c27e66f@x6 9g2000hsx.googl egroups.com...
    hi friends
    i've built a page that should show first 150 chars of every of my
    topics but when i wanted to do this work with SubString() it included
    the tags of my field of my db and very bad viewing happend
    i want to retrieve rendered text without any tag ...
    please help me ...

    Comment

    • =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=

      #3
      Re: problem with tags

      Goo evening,

      I think he's trying to trim text containing HTML content (which isn't
      trivial).
      --
      Milosz


      "Jonathan Wood" wrote:
      Sounds like there's a problem with your code, but you didn't include your
      code, or any details about what you are doing beyond using SubString() so I
      really don't see how anyone can help you.
      >
      Perhaps you should show, or at least describe, just what you are doing.
      >
      Beyond that, you can set a break point at look at the string being passed to
      Substring and your arguments and you should be able to see why it returns
      what it does.
      >
      --
      Jonathan Wood
      SoftCircuits Programming

      >
      <miladhatam@gma il.comwrote in message
      news:d609e7fb-4088-4381-a255-950d0c27e66f@x6 9g2000hsx.googl egroups.com...
      hi friends
      i've built a page that should show first 150 chars of every of my
      topics but when i wanted to do this work with SubString() it included
      the tags of my field of my db and very bad viewing happend
      i want to retrieve rendered text without any tag ...
      please help me ...
      >
      >

      Comment

      • Jonathan Wood

        #4
        Re: problem with tags

        Perhaps, that's something I've done. It's just hard to help someone when
        they don't show what they did.

        --
        Jonathan Wood
        SoftCircuits Programming


        "Milosz Skalecki [MCAD]" <mily242@DONTLI KESPAMwp.plwrot e in message
        news:598C001D-9859-45E5-85B2-86869A1A8331@mi crosoft.com...
        Goo evening,
        >
        I think he's trying to trim text containing HTML content (which isn't
        trivial).
        --
        Milosz
        >
        >
        "Jonathan Wood" wrote:
        >
        >Sounds like there's a problem with your code, but you didn't include your
        >code, or any details about what you are doing beyond using SubString() so
        >I
        >really don't see how anyone can help you.
        >>
        >Perhaps you should show, or at least describe, just what you are doing.
        >>
        >Beyond that, you can set a break point at look at the string being passed
        >to
        >Substring and your arguments and you should be able to see why it returns
        >what it does.
        >>
        >--
        >Jonathan Wood
        >SoftCircuits Programming
        >http://www.softcircuits.com
        >>
        ><miladhatam@gm ail.comwrote in message
        >news:d609e7f b-4088-4381-a255-950d0c27e66f@x6 9g2000hsx.googl egroups.com...
        hi friends
        i've built a page that should show first 150 chars of every of my
        topics but when i wanted to do this work with SubString() it included
        the tags of my field of my db and very bad viewing happend
        i want to retrieve rendered text without any tag ...
        please help me ...
        >>
        >>

        Comment

        • miladhatam@gmail.com

          #5
          Re: problem with tags

          :)
          sorry my english language is not good
          for eg :
          in my record of field is this text
          <bhello world </b>
          and i want to show only 5 first chars
          i don't want the "<b>" tag be
          i need my basic text without any style
          that is the "hello"
          thanks for your attention

          Comment

          • marss

            #6
            Re: problem with tags

            On 16 Січ, 07:15, "miladha...@gma il.com" <miladha...@gma il.comwrote:
            in my record of field is this text
            <bhello world </b>
            and i want to show only 5 first chars
            i don't want the "<b>" tag be
            i need my basic text without any style
            that is the "hello"
            Remove tag by means of a regular expression.

            Regex re = new Regex("<[^>]*>", RegexOptions.Mu ltiline);
            string pureText = re.Replace(orig inalString, "");

            And then pureText.SubStr ing(..

            Regards
            Mykola
            http://marss.co.ua - Casual ideas for web development

            Comment

            • miladhatam@gmail.com

              #7
              Re: problem with tags

              oh thanks
              i do this and work well
              thanks my friend

              Comment

              • =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=

                #8
                Re: problem with tags

                Goo evening guys,

                Having said it's not a trivial task i meant it's not trivial when trimming
                text but persisting HTML. Mars' resolution will work only in most all of the
                cases, but not if you trim the text at a html encoded character. This case is
                easy to handle by making sure by checking if the ampersand is not included in
                last 6 characters. Similar issue to this:


                Regards
                --
                Milosz


                "marss" wrote:
                On 16 Січ, 07:15, "miladha...@gma il.com" <miladha...@gma il.comwrote:
                >
                in my record of field is this text
                <bhello world </b>
                and i want to show only 5 first chars
                i don't want the "<b>" tag be
                i need my basic text without any style
                that is the "hello"
                >
                Remove tag by means of a regular expression.
                >
                Regex re = new Regex("<[^>]*>", RegexOptions.Mu ltiline);
                string pureText = re.Replace(orig inalString, "");
                >
                And then pureText.SubStr ing(..
                >
                Regards
                Mykola
                http://marss.co.ua - Casual ideas for web development
                >
                >

                Comment

                Working...