Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    TrainReq
    Guest

    Setting max length

    I have a var called str ( var str= ) , which is later defined by several propertys .. how do I more/less go ... if str is longer than 298 charicters , shorten it down to make sure it is no longer than 298 charicters.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Isnt' it you already have that in this thread?
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    TrainReq
    Guest
    no .. that is checking browser type to run that function .. this is how to run the function instead .. but i dont think i did it right because the function isnt running right.

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    I'm not saying the browser type checking but this:
    Code:
    if(st.length > 2083) st = st.substr(0, 2083);
    If you want to set str the maximum length of 298, then you'd do the same thing.
    Code:
    if(str.length > 298) str = str.substr(0, 298);
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •