problem with "|" character while splitting text or string.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fmuddy
    New Member
    • Mar 2010
    • 4

    problem with "|" character while splitting text or string.

    hi everybody,
    I am having problem with "|" character while splitting text or string. but all other characters are working like (/ ; , - _).

    Does "|" has a special property or does it related about its ASCII code?

    my code is;

    String delimeter="0";
    int k = 0;
    String[] list;
    String line = buf.readLine();
    while (line != null) {
    if(k==0){
    line=buf.readLi ne();
    k++;
    continue;
    }

    list = line.split(deli meter);
    System.out.prin tln(list[0]);
    System.out.prin tln(list[1]);
    System.out.prin tln(list[2]);
    line = buf.readLine();
    k++;



    }
  • april198474
    New Member
    • Mar 2010
    • 1

    #2
    Hi,
    In java, '|'is Bitwise, it means or.
    _______________ ______

    April

    Free Live Chat Software

    Comment

    • pbrockway2
      Recognized Expert New Member
      • Nov 2007
      • 151

      #3
      Actually the OP was trying to use the pipe symbol as part of a regular expression in order to split a string like "fee|fie|foe|fu m".

      He or she obtained their answer at another forum. But evidently they couldn't be bothered posting back here to say it was solved.

      Comment

      • fmuddy
        New Member
        • Mar 2010
        • 4

        #4
        thanks everybody. i got the solution.

        Comment

        • ahmee
          New Member
          • Mar 2010
          • 39

          #5
          mY friend "|" this symbol is knwn as pipe symbol and is used for various works like...
          int a=0;
          int b=0;

          if(a==0||b==0)// it will check either a or b that if they are equals too 0, if so statement the exautes and no need that both the statements should be true
          {
          System.out.prin tln("you are right");
          }

          Comment

          Working...