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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Scan until character found?

    Hi folks.

    I need some code done for this problem.

    Instead of;

    element would be; DM016A_RF_LIMS

    element=formName.LIMIT_lb.options[i].text
    compare=element.substr(0,5);

    I need;

    element=formName.LIMIT_lb.options[i].text
    compare=element (string up until the first underscore, NOT THE 1st FIVE CHARACTERS as above)

    ?

    Cheers

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    indexOf may be what you're looking for:
    Code:
     var element = formName.LIMIT_lb.options[i].text
     var e = element.indexOf('_');
     var compare = element.substring(0, e);
    Hope that helps,
    Sadiq.


  •  

    Posting Permissions

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