Results 1 to 8 of 8

Thread: How to find VBCRLF ( char 13 ) in a String

  1. #1
    DaoK
    Guest

    How to find VBCRLF ( char 13 ) in a String

    Here is what I have but it does not work !

    Code:
    public static String Daok(String varStr)
      {
      int i=0;
      for (i=0; i < varStr.length ();i++)
      {
        if (varStr.charAt (i) == 13)
          System.out.println ("One Enter Found");
      }
      return "-----> " + varStr + " <-----";
      }
    }

  2. #2
    Never ever use ASCII in a Java program. Everything's Unicode.

    Code:
    System.out.println(someString.indexOf('\n'));

  3. #3
    DaoK
    Guest
    Code:
        if (varStr.charAt (i) == varStr.indexOf ('\n'))
          //ACTION HERE
    That does not work

  4. #4
    Do not loop through the string, my code returns the first index of a newline.

  5. #5
    DaoK
    Guest
    ok but I want to know each place of each VbCrLf and it return only the number 27 ?

  6. #6
    Read these: http://java.sun.com/j2se/1.3/docs/api/index.html ; specifically the one for the String class

    Also, just a theory:
    Code:
    for (int i = 0; i < s.length(); i++)
    {
        if (s.charAt(i) == '\n')
        {
            System.out.println("Found newline at " + i);
        }
    }

  7. #7
    DaoK
    Guest
    Thx for the code!

    Thx for the link ! I searched in java.sun.org something like that but I did not achieve to any good result!

    Thx you

  8. #8
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Ive been looking at a lot of networking code lately and i know that Unix usually termanates a line with a linefeed (\n) Mac a carriage return (\r) and Windows a carriage return linefeed pair
    (\r\n).

    So Daok you should be able to test for bolth.

Posting Permissions

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



Click Here to Expand Forum to Full Width