Trim text, strings - I am pulling my hair out

Discussion in 'HTML & Website Design' started by I_Basically_need_help, Dec 14, 2005.

  1. #1
    I am pulling my hair out, I a lot of radio buttons. I am using a comma to split my values.

    The left is for the part number string and the right is for the sum price.

    I do not care about the info to the right of the comma, I got that worked out.

    The numbers and or letters to the left of the comma are what I am trying to collect.

    Examples

    type=radio value=1B-,0.18
    type=radio value=1RB-,0.11
    type=radio value=A4B-,0.16
    type=radio value=1tB-,0.72

    item1 = 1B-,0.18
    item2 = 1RB-,0.11

    and on and on

    Some thing like: My_Var1 = Left(item1, 3) this would give me 1B-

    Then I need string all the My_Part_No = My_Var1 & My_Var2 & My_Var2 etc..

    I must have brain damage, very little effort to break the prices off and sum them but for some reason I can not figure out the strings.

    Can someone give an old VB programmer some help with his JAVA.
     
    I_Basically_need_help, Dec 14, 2005 IP
  2. Sham

    Sham Peon

    Messages:
    136
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    look at java's String.split() which returns a list of strings split at the delimiter you specify. In the case of your values, it would be a 2 element array containing {"1b-", "0.18} if you did item1.split(",");
     
    Sham, Dec 14, 2005 IP
  3. I_Basically_need_help

    I_Basically_need_help Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    + item1.slice(0,1) + item2.slice(0,1) this gave me 1B-1RB

    I don't get it but I am going with this for now, slice should not slice an array, i thought it was just for text.

    :D
     
    I_Basically_need_help, Dec 15, 2005 IP