File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Can get the Form Feed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Can get the Form Feed "\f" to work!" Watch "Can get the Form Feed "\f" to work!" New topic
Author

Can get the Form Feed "\f" to work!

bob connolly
Ranch Hand

Joined: Mar 10, 2004
Posts: 204
I'm trying to figure out why the FORM FEED "\f" doesn't seem to be working? please see the <<<<<<<<<<<<<<<<<<< mark

Thanks much!

[code]
import java.io.*;
import java.util.*;

public class r3
{
public static void main(String[] args)
{
try
{
BufferedReader textReader = new BufferedReader(new FileReader("r2.out.sort"));
String line = null; String SEPARATOR = ",";
while ( (line = textReader.readLine()) != null )
{
String[] sa = line.split(SEPARATOR);
String fn = line;

if (fn.indexOf(".java")>0 || fn.indexOf(".xml")>0 || fn.indexOf(".jsp")>0 )
{
System.out.print("\f"); <<<<<<<<<<<<<<<<<<<<
System.out.println(fn);
char isjsp=' ';isjsp=' ';if (fn.indexOf(".jsp")>0) isjsp='y';
try
{
BufferedReader tr2 = new BufferedReader(new FileReader(fn));
String line2 = new String();
while ((line2 = tr2.readLine()) != null )
{
if (isjsp=='y') line2=line2.trim();
System.out.println(line2);
}
tr2.close();
}
catch (IOException e) {System.out.println(e);}
}
}
textReader.close();
} catch (IOException e) {System.out.println(e);}
}
}
[\code]

I was searching the WEB and found this list, been looking for something like this, simple, for years, so i thought i'd share it!

ASCII Character Set

Decimal Hex Octal Print Definition
======= === ===== ====== =========================
0 00 000 NUL (Null)
1 01 001 ^A SOH (Start of heading)
2 02 002 ^B STX (Start of text)
3 03 003 ^C ETX (End of text)
4 04 004 ^D EOT (End of transmission)
5 05 005 ^E ENQ (Enquiry)
6 06 006 ^F ACK (Acknowledge)
7 07 007 ^G BEL (Ring bell)
8 08 010 ^H BS (Backspace)
9 09 011 ^I HT (Horizontal tab)
10 0A 012 ^J LF (Line feed)
11 0B 013 ^K VT (Vertical tab)
12 0C 014 ^L FF (Form feed)
13 0D 015 ^M CR (Carriage return)
14 0E 016 ^N SO (Shift out)
15 0F 017 ^O SI (Shift in)
16 10 020 ^P DLE (Data link escape)
17 11 021 ^Q DC1 (Device control 1)
18 12 022 ^R DC2 (Device control 2)
19 13 023 ^S DC3 (Device control 3)
20 14 024 ^T DC4 (Device control 4)
21 15 025 ^U NAK (Negative acknowledge)
22 16 026 ^V SYN (Synchronous idle)
23 17 027 ^W ETB (End of transmission block)
24 18 030 ^X CAN (Cancel)
25 19 031 ^Y EM (End of medium)
26 1A 032 ^Z SUB (Substitute)
27 1B 033 ESC (Escape)
28 1C 034 FS (File separator)
29 1D 035 GS (Group separator)
30 1E 036 RS (Record separator)
31 1F 037 US (Unit separator)

32 20 040 SP (Space)
33 21 041 !
34 22 042 "
35 23 043 #
36 24 044 $
37 25 045 %
38 26 046 &
39 27 047 '
40 28 050 (
41 29 051 )
42 2A 052 *
43 2B 053 +
44 2C 054 ,
45 2D 055 -
46 2E 056 .
47 2F 057 /
48 30 060 0
49 31 061 1
50 32 062 2
51 33 063 3
52 34 064 4
53 35 065 5
54 36 066 6
55 37 067 7
56 38 070 8
57 39 071 9
58 3A 072 :
59 3B 073 ;
60 3C 074 <
61 3D 075 =
62 3E 076 >
63 3F 077 ?
64 40 100 @
65 41 101 A
66 42 102 B
67 43 103 C
68 44 104 D
69 45 105 E
70 46 106 F
71 47 107 G
72 48 110 H
73 49 111 I
74 4A 112 J
75 4B 113 K
76 4C 114 L
77 4D 115 M
78 4E 116 N
79 4F 117 O
80 50 120 P
81 51 121 Q
82 52 122 R
83 53 123 S
84 54 124 T
85 55 125 U
86 56 126 V
87 57 127 W
88 58 130 X
89 59 131 Y
90 5A 132 Z
91 5B 133 [
92 5C 134 \
93 5D 135 ]
94 5E 136 ^
95 5F 137 _
96 60 140 `
97 61 141 a
98 62 142 b
99 63 143 c
100 64 144 d
101 65 145 e
102 66 146 f
103 67 147 g
104 68 150 h
105 69 151 i
106 6A 152 j
107 6B 153 k
108 6C 154 l
109 6D 155 m
110 6E 156 n
111 6F 157 o
112 70 160 p
113 71 161 q
114 72 162 r
115 73 163 s
116 74 164 t
117 75 165 u
118 76 166 v
119 77 167 w
120 78 170 x
121 79 171 y
122 7A 172 z
123 7B 173 {
124 7C 174 |
125 7D 175 }
126 7E 176 ~
127 7F 177 DEL (Delete)


Special Codes for HTML - ampersand, number, semicolon
em-dash � #0151
copyright � #0169

#09; Horizontal tab
#10;
Line feed
#13;
Carriage Return
#32; Space
#33; ! Exclamation mark
#34; " Quotation mark
#35; # Number sign
#36; $ Dollar sign
#37; % Percent sign
#38; & Ampersand
#39; ' Apostrophe
#40; ( Left parenthesis
#41; ) Right parenthesis
#42; * Asterisk
#43; + Plus sign
#44; , Comma
#45; - Hyphen
#46; . Period (fullstop)
#47; / Solidus (slash)
#48; - #57; Digits 0-9
#58; : Colon
#59; ; Semi-colon
#60; < Less than
#61; = Equals sign
#62; > Greater than
#63; ? Question mark
#64; @ Commercial at
#65; - #90; Letters A-Z
#91; [ Left square bracket
#92; \ Reverse solidus (backslash)
#93; ] Right square bracket
#94; ^ Caret
#95; _ Horizontal bar (underscore)
#96; ` Acute accent
#97; - #122; Letters a-z
#123;{ Left curly brace
#124;| Vertical bar
#125;} Right curly brace
#126;~ Tilde
#160; Non-breaking Space
#161;� Inverted exclamation
#162;� Cent sign
#163;� Pound sterling
#164;� General currency sign
#165;� Yen sign
#166;� Broken vertical bar
#167;� Section sign
#168;� Umlaut (dieresis)
#169;� Copyright
#170;� Feminine ordinal
#171;� Left angle quote, guillemotleft
#172;� Not sign
#173;� Soft hyphen
#174;� Registered trademark
#175;� Macron accent
#176;� Degree sign
#177;� Plus or minus
#178;� Superscript two
#179;� Superscript three
#180;� Acute accent
#181;� Micro sign
#182;� Paragraph sign
#183;� Middle dot
#184;� Cedilla
#185;� Superscript one
#186;� Masculine ordinal
#187;� Right angle quote, guillemotright
#188;� Fraction one-fourth
#189;� Fraction one-half
#190;� Fraction three-fourths
#191;� Inverted question mark
#192;� Capital A, grave accent
#193;� Capital A, acute accent
#194;� Capital A, circumflex accent
#195;� Capital A, tilde
#196;� Capital A, dieresis or umlaut mark
#197;� Capital A, ring
#198;� Capital AE dipthong (ligature)
#199;� Capital C, cedilla
#200;� Capital E, grave accent
#201;� Capital E, acute accent
#202;� Capital E, circumflex accent
#203;� Capital E, dieresis or umlaut mark
#204;� Capital I, grave accent
#205;� Capital I, acute accent
#206;� Capital I, circumflex accent
#207;� Capital I, dieresis or umlaut mark
#208;� Capital Eth, Icelandic
#209;� Capital N, tilde
#210;� Capital O, grave accent
#211;� Capital O, acute accent
#212;� Capital O, circumflex accent
#213;� Capital O, tilde
#214;� Capital O, dieresis or umlaut mark
#215;� Multiply sign
#216;� Capital O, slash
#217;� Capital U, grave accent
#218;� Capital U, acute accent
#219;� Capital U, circumflex accent
#220;� Capital U, dieresis or umlaut mark
#221;� Capital Y, acute accent
#222;� Capital THORN, Icelandic
#223;� Small sharp s, German (sz ligature)
#224;� Small a, grave accent
#225;� Small a, acute accent
#226;� Small a, circumflex accent
#227;� Small a, tilde
#228;� Small a, dieresis or umlaut mark
#229;� Small a, ring
#230;� Small ae dipthong (ligature)
#231;� Small c, cedilla
#232;� Small e, grave accent
#233;� Small e, acute accent
#234;� Small e, circumflex accent
#235;� Small e, dieresis or umlaut mark
#236;� Small i, grave accent
#237;� Small i, acute accent
#238;� Small i, circumflex accent
#239;� Small i, dieresis or umlaut mark
#240;� Small eth, Icelandic
#241;� Small n, tilde
#242;� Small o, grave accent
#243;� Small o, acute accent
#244;� Small o, circumflex accent
#245;� Small o, tilde
#246;� Small o, dieresis or umlaut mark
#247;� Division sign
#248;� Small o, slash
#249;� Small u, grave accent
#250;� Small u, acute accent
#251;� Small u, circumflex accent
#252;� Small u, dieresis or umlaut mark
#253;� Small y, acute accent
#254;� Small thorn, Icelandic
#255;� Small y, dieresis or umlaut mark







--------------------------------------------------------------------------------
| Home | Showcase | Products & Services | Technology |
| Corporate | News | Contact | Links | Sitemap |
Terms & Conditions/Copyright/Confidentiality

� Copyright 1998 wcm Solutions, Inc.
All Rights Reserved
Austin, Texas - voice/cell +1.512.336.0842
email: info@wcmsolutions.com
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

How certain character values are interpreted depends on your environment. For example, I don't think the form feed character works as intended in a Windows Command Prompt, although it does in a Mac Terminal.

See this thread...

http://www.coderanch.com/t/399847/java/java/when-why-we-FF-CR

PS: Here's a quick link for character values...

http://www.lookuptables.com/
[ August 25, 2005: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
bob connolly
Ranch Hand

Joined: Mar 10, 2004
Posts: 204
Thanks Mark!
bob connolly
Ranch Hand

Joined: Mar 10, 2004
Posts: 204
Hi Mark,

got it, i needed to route the print from unix and use this command

lp -d xr1070_2110penn "r3.out"

and now it's form feeding correctly, but when i cut and pasted to a .txt file on windows, it must have deleted the FORM FEED character!

Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can get the Form Feed "\f" to work!