1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to prevent or any solution for the too long string text

Discussion in 'C#' started by wacamoi, Nov 11, 2007.

  1. #1
    any solution to prevent too long string text for guest book

    for example:

    some one type in

    hooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
    SEMrush
    It is even better if you can give real example case or site.
    I like to give you good rep if you have good solution.

    :)
     
    wacamoi, Nov 11, 2007 IP
    SEMrush
  2. Techno_EG

    Techno_EG Peon

    Messages:
    12
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    what did you want to make with this too long string???
    for EX:
    hoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

    after code
    hooooooooooooooooooooooo
    oooooooooooooooooooooooo
    oooooooooooooooooooooooo
    oooooooooooooooooooooooo
    oooooooooooooooooooooooo
     
    Techno_EG, Nov 11, 2007 IP
  3. wacamoi

    wacamoi Peon

    Messages:
    810
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #3
    yes can be that way

    any "creative way" will be fine

    if you have any new idea will be even better......

    Thanks
     
    wacamoi, Nov 12, 2007 IP
  4. Techno_EG

    Techno_EG Peon

    Messages:
    12
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    
    <%
    
    Function StringC(StringText,LongN) 
    on error resume next
    dim TXTC
    TXTC=left(StringText,LongN-1) & "<BR>"
    for MU=1 to int(len(StringText)/LongN)
    TXTC=TXTC & mid(StringText,MU*LongN,LongN) & "<BR>"
    Next
    StringC=TXTC
    End Function
    
    
    Response.write StringC("HOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",20)
    
    %>
    
    Code (markup):
    if you have any problem with code i'm ready to help you;)
     
    Techno_EG, Nov 12, 2007 IP
    wacamoi likes this.
  5. wacamoi

    wacamoi Peon

    Messages:
    810
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I got result:
    HOOOOOOOOOOOOOOOOOO
    OOOOOOOOOOOOOOOOOOOO
    OOOOOOOOOOOOOOOOOOOO
    OOOOOOOOOOOOOOOOOOOO
    OOOOOOOOOOOOOOOOOOOO
    OO


    thanks for contributing the code
    It is one of nice one.
    the long string has been forced to be cut in every length 20
    why TXTC=left(StringText,LongN-1)
    why not TXTC=left(StringText,LongN-0)


    A good rep for Techno_EG from me

    :)

    It will be even better if you can make sure not to cut a word into to parts.

    :D
     
    wacamoi, Nov 12, 2007 IP
  6. rena

    rena Peon

    Messages:
    1,987
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #6
    very simple, use javascript or if you are using .net give validation controll you can give condition in the controll
     
    rena, Nov 17, 2007 IP
  7. orielo

    orielo Peon

    Messages:
    175
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #7
    isnt it simple to put the output into a div ?
    the div Propertie NOWRAP - Sets or retrieves whether the browser automatically performs wordwrap.
    so,
    if you dont define the NOWRAP Propertie in the div tag,
    it will auto wrap it.

    <div id="Output" width="100px"><%=OutputSTR%></div>
    Code (markup):
    this code should result a 100 pixels wide div, which will auto wrap the content.

    gl.
     
    orielo, Nov 19, 2007 IP
    wacamoi likes this.
  8. wacamoi

    wacamoi Peon

    Messages:
    810
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Thanks
    That does some help.
    rep added
     
    wacamoi, Nov 20, 2007 IP
  9. orielo

    orielo Peon

    Messages:
    175
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #9
    np,
    glad to help :).
     
    orielo, Nov 20, 2007 IP