Limiting characters in a line

How do you limit char in a line
Ex
1 st line has 1 char
2 nd line has 2chars
3 rd line has 3 chars
4 th line has 4 chars
& so on
any help would be appereciated.

> any help would be appereciated.
Yes, we know you need to make an alphabetical
triangle completed with *'s.
Input "h" should produce:
A
BC
DEF
GH**All very clear described in your previous thread
http://forum.java.sun.com/thread.jspa?threadID=688845
I gave you a start but you kept begging for code. How
about trying it yourself? If you get stuck, post the
code here and I'm sure someone will give you a hand.
To refresh your memory, here is my hint again:
char letter = 'H';
for(int i = (int)'A'; i <= (int)letter; i++) {
c.print((char)i);
My teacher said i need to limit the characters in the line.
1 has 1
2 has 2
and so on

Similar Messages

  • Printing the First 14 Characters of Every Line in a Text File

    My text file looks like the following:
    1111097116274, H0101C58F8110C005, 1, 16:48:03
    1111097116274, H0100058F8110C006, 2, 16:48:10
    1111097116274, H00F0458F8110C006, 3, 16:48:12I want my java program to print the first 14 characters of every line. Here's what I have:
    import java.awt.*;
    import javax.swing.JOptionPane;
    import java.io.*;
    public class Read {
         public static void main( String args[] ) {
        try {
            BufferedReader in = new BufferedReader(new FileReader("aFile.txt"));
            String line;;
            /*String tagid;*/
            while ((line = in.readLine()) != null) {
                 char[] tagid = line.toCharArray();
                 line.getChars(0, 14, tagid, 0); 
                 System.out.println(tagid);
            in.close();
        } catch (IOException e) {
             JOptionPane.showMessageDialog( null, "Error" );
             System.exit(0);
         Instead of printing the first 14 characters of every line to output, it prints the whole text file.
    Any ideas of what's wrong?
    Thanks.

    Well, that's the thing with a highly tuned, precision engine like your mind, JosAH. Adding a little alchohol to the fuel mix provides a performance boost, but as the alcohol/fuel ration increases, the performance improvement peaks and then degrades, until the performance is actually reduced. Now, I understand that in the case of the magic Grolsch, this performance curve is shifted farther to the right (graphed with Grolsch count as the independent variable, and performance improvement as the dependent variable), but it still occurs.
    I recommend nitrous oxide. You may need to get your piston heads hardened, though.
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Dropping characters in text lines (FM8)

    I'm experiencing problems with dropped characters in text lines. Also, I've noticed the history doesn't seem to log all changes made to text lines. The problem can be duplicated as follows:
    1. Open a new portrait blank document and add an anchored frame. (recorded in history)
    2. Add a text line inside the anchored frame from the Tools Palette. In the text line, type "1234" (recorded in history).
    3. Save the file. (history cleared)
    4. Click the cursor after the "4" in the text line and hit a carriage return to create a new text line. (not recorded in history)
    5. In the new text line, type "1234567890"(not recorded in history)
    6. Save the file.
    7. Refresh the screen (cntl l) and the second text line now reads "12346890" (dropped the 5 and 7). Printing the file in steps 5 and 6 also show the 5 and 7 are missing.
    8. Add a new text line inside the anchored frame from the Tools Palette. In the text line, type "12345" (recorded in history).
    9. Save the file. (history cleared)
    10. Click the cursor after the "5" in the text line from step 8 and hit a carriage return to create a new text line. (not recorded in history)
    11. In the new text line, type "1234567890"(not recorded in history)
    12. Save the file.
    13. Refresh the screen and the second text line now reads "12345790" (dropped the 6 and 8).
    Has anyone else seen this problem (or can duplicate it)?
    Also, can someone explain why some of the steps above are not recorded in the history.
    FYI, while trying to find a repeatable sequence to demonstrate this problem, Frame crashed on me.
    I'm running a trial version of Frame 8, version 8.0p273, with XP Pro, on a fairly new Dell Optiplex 740.
    Thanks,
    Jeff Schweiner

    Hi Jeff,
    I have now tried what you're doing and get the same result!
    I have also added a text line with characters a to z. After saving ad doing a ctrl-l, the character after the last one, and the character second after that, in the previous line, was removed. (I first typed "abcd", saved, made a new line, typed "abcdefghi", saved, made ctrl-l, the characters "e" and "g" were removed).
    I have the same version of FrameMaker + SGML, but this is a licensed version, running on Win 2000.
    Regards
    Mikael Sten

  • Please Help!!   (Stripping first 7 Characters of every line in a file???

    Hey guys,
    I need to read in a file but strip the first 7 characters from each line in the file???
    How do i do it...
    Any help will be appreciated...

    Dear Friend,
    Thankyou very much for your interest.
    I am trying to strip the 1st 7 characters from the following file while reading....
    1. <?xml version="1.0" encoding="UTF-8"?>
    2.
    3. <DOCUMENT>
    4. <GREETING>
    5. THE LIVE EXAMPLE...
    6. <MESSAGE>
    7. </GREETING
    8. If this works then your project is over...;;;
    9. </MESSAGE>
    10. </DOCUMENT>
    I meant, if my file contains line break (space of a line between two lines just like in Double Line spacing. Eg. between 1 and 3).... the program doesn't read after reading the first line. Your method does stip first seven characters of first line...
    Your help is appreciated....

  • How to handle the limitation of 9999 remittance line item for CTX payments

    Hi,
       I need to send the CTX payment from SAP in XML file format to vendors bank.
       SAP F110 -> Treasury -> Our Bank -> FED clearing system -> vendor bank.
       Fed Clearing system has a limitation of 9999 remittance line item for CTX payments.
       Do we have any standard SAP setting wherein total number of invoice in payment document can          be     limited to 9999.
    Please Advice.

    Hi ,
    First of all the Event R418 as you have mentioned have the structures FKKKO and FKKOP .
    In FKKKO you will not get the sub item and in FKKOP you will get the sub itmes .
    Before the process gets in to Event R418 it has only 1 line item and hence you are facing the problem .
    If you have multiple line items getting in to the FM then you can build the logic based on the Import date that is passed in structure FKKOP .
    Else try for the function module FKK_OPEN_ITEM_SPLIT , in R418 where in you can split the document if you are having only 1 entry in FKKOP.
    Kindly check and revert back with your findings .
    Regards ,
    Dewang

  • Printing specific characters of a line of text

    Does anyone know of a good way to extract certain characters from a line of text. Such as printing the first two characters or characters 3 and 4 or characters 7-13 etc. It seems like sed should be able to do this, but I can't find any examples online.
    Thanks!

    This command will extract the last 3 characters from every line:
    sed 's|^.*\(...\)$|\1|'
    Middle characters are a little harder. This command extracts the 23rd, 24th, and 25th characters from every line:
    sed 's|^.\{22\}\(...\).*|\1|'
    But if you are doing columnwise operations, a better tool is awk and not sed.

  • PLD - limiting the amount of lines

    I have read some of the other threads regarding limiting the amount of lines in a repetitive area.  I tried to apply this to my current layout, I am formatting a check, the print is going into the tear away section on the check. 
    The check is printing 15 lines in this area and I would only like to print 13.  I change the format section to 13 lines in repetitive area, with nil effect on the output.  Are there any other options?

    Hi
    What is your set up for print preference for checks for layout ?
    Go to administration >> System Initilaisation >>Print Preference
    Click on Document tab>>
    Find checks for payment >>
    What is the maximum lines you have set ?
    Hope this helps to troubleshoot your issue
    Thank you
    Bishal

  • Prevent Scrolling in TextArea NOT by limiting characters.

    It would seem to me to be a standard part of any API, but it seems not (else I cannot find it using keywords).
    I need the ability to create a TextArea entity in a constrained area (i.e., it is  located at x, and y and is w pixels wide and h pixels high and have that never change.), containing a proportional width font.  As such, no 'num char entry limit' strategy is feasible.  They need to be able to fill the entire area, and if that means 1,000 period '.' characters, or 200 '#' or "W' characters, then so be it.
    In case someone reading this isn't following what I mean.   The two lines following this one consist of 30 periods followed by 30 Ws.
    WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
    I cannot limit a user to 30 characters.  They need to be limited by using a TextArea that will let itself be filled until full, and then refuse further input until space is created by removing existing content.
    I then need to print that TextArea _as rendered on the user's screen_.
    Any 'scrolled' lines would be unprintable, and therefore the user's entry must be limited BEFORE any scrolling occurs, or contrariwise, when scrolling occurs, the last entered content would need to be removed and the entity forced to un-scroll.  I can program this.  It won't be elegant, and in fact will be quite stupid, as any programming where a change event is called with each keystroke or paste and then conditions tested is inefficient, wasteful, and well.. stupid.
    Please tell me that there is a more elegant solution that I'm just too dense to find it in the API.  I would think this would be a very common no-brainer functionality to put in a component for people designing WYSIWYG interfaces.
    Thanks muchly for any advice, help, solutions, even criticisms if justified
    BTW.. I hate CS4's documentation.  Is there a way to restore it to appearing in the program itself and being available offline?  Is there any way to constrain it to NEVER EVER EVER look for answers outside of the context of the program I initiated the help request from?  I don't want to know that it found a similar keyword in Acrobat or Illustrator documentation.    It makes about as much sense as the damage they've done to the forums by changing the 'search this forum' to 'search forums'.  It makes far more sense to search within a narrowed context with the OPTION of expanding the context, than to return a thousand useless non-appropriate returns to then have to go and explicitly (and annoyingly and time-wastingly) narrow the context every time AFTER you had a load of useless garbage dumped in your lap to be first reviewed and then discarded.    Sorry.. I'm a grouch.   I still love you Adobe and love developing using your stuffies... you just don't make much sense to me sometimes....  Local docs with updates as part of the periodic Adobe Software Update.  Constrained context UNLESS I ask for an expanded search.  Every keyword linked to the associated doc... If the name of a class appears in documentation, link it to that class API, etc

    Thank you, yes, that's part of my programming method.
    I can either snoop the CHANGE event or the SCROLL event and evaluate that property, and from there enter a while loop that removes the last character entered and then sets the scroll position back to the top (and ignoring the SCROLL even that itself triggers), and then reevaluates to see if the condition has been rectified, and if not, then removes the next most recent character.  That's not efficient, and it's possible that events can trigger/handle out of order I believe.   It could also be a nightmare if a user pastes in the entire contents of War and Peace and it has to loop either a) as each character of the paste is entered, or b) after the paste is entered, removing one character at the entry point until the condition is rectified.  I'm not certain whether a) or b) is the truth for how pasted content is handled...   Either way, I don't think I can assume that if I remove one character and set the scroll position back to 1, that I'll necessarily remedy the condition w/o rechecking.
    I'm still in the middle of working up a solution, but I think I have to do something like this (correct me if I'm wrong)....
    Establish a variable to track the number of lines that can be entered before scrolling occurs....  Let's call it maxLines.
    I cannot know what that value of maxLines is when the instance is created, so it is necessarily a non-useful value on initiation (0, or -1, or null... I'll go with 0).
    The first time the SCROLL event is called, that variable value can be determined by textField.numLines minus 1 and assigned to maxLines
    Thereafter, register a CHANGE event listener and each time a change is made, make certain that numLines does not exceed maxLines.  From this point forward, it would be foolish to keep tracking the SCROLL event, because each time my code corrects a scroll condition, it must visually scroll back to the top, itself generating a SCROLL event.
    Either way, it's silly.  There's no reason that there could not be a policy available to disable scrolling entirely.   Cheers!

  • PHP MYSQL and DW Question: Invalid characters and new lines entry/viewing

    Hello all,
    I have followed David Powers' two php/dw/mysql books and I've
    set up PHP
    pages that insert, edit, delete, etc. listings. Everything
    works fine
    except for invalid characters being inserted into the
    database, and then
    displaying with a question mark in firefox.
    Is there a trick to cleaning up the data that a user may
    paste into a
    textbox on a web page for insertion in the database before
    the data is
    inserted or as it is inserted? Em dashes, en dashes, 'curly
    quotes' etc.
    are giving me problems.
    Also, when I enter new lines into the php page while I'm
    typing out
    information for a record, these new lines are not being
    displayed either
    in the database (using phpmyadmin to view) or on the
    resulting details
    pages, even though I'm using nl2br, etc. Is there a way to
    make this
    work reliably?
    Thank you for any help you may give me!
    -John

    Hello all,
    I have followed David Powers' two php/dw/mysql books and I've
    set up PHP
    pages that insert, edit, delete, etc. listings. Everything
    works fine
    except for invalid characters being inserted into the
    database, and then
    displaying with a question mark in firefox.
    Is there a trick to cleaning up the data that a user may
    paste into a
    textbox on a web page for insertion in the database before
    the data is
    inserted or as it is inserted? Em dashes, en dashes, 'curly
    quotes' etc.
    are giving me problems.
    Also, when I enter new lines into the php page while I'm
    typing out
    information for a record, these new lines are not being
    displayed either
    in the database (using phpmyadmin to view) or on the
    resulting details
    pages, even though I'm using nl2br, etc. Is there a way to
    make this
    work reliably?
    Thank you for any help you may give me!
    -John

  • Non english characters in commnd line sqlplus

    Guys,
    In linux,
    How to see hindi characters in terminal based SQLPLUS?
    IN GUI based SQLPLUS,i can see hindi characters but in COmmand line SQLPLUS,the hindi rows show empty boxes.

    Check the thread on similar kind of doubt.
    Re: non-english characters in sqlplus
    Regards,
    Sabdar Syed.

  • Some characters gain extra lines or are broken when printing to PDF

    I am having a problem with some characters rendering oddly when I print to PDF.
    Examples are an extra vertical line next to an upright character, and extra partial curve to the left of an opening parenthesis, or a slight cut-off of a curve in a character.  All of these seem to be in the vertical plane.  It is not consistently tied to particular character combinations - the same word may render correctly in one instance, but incorrectly in another.
    I am using Microsoft Word 2007, and printing to PDF via Adobe PDF Converter (CS4).  The font is Gill Sans MT Light, and the document is 230 pages.
    Can anyone seen anything similar before, or can someone suggest anything I can look into further?

    You may have to turn on "display large images" in the preferences.

  • Mountain Lion Mail cannot search for non-alpha characters in Subject Lines

    Under 10.8.3, Mail 6.3 often cannot successfully find messages if the search string contains a non-alpha character.
    I have only tested this searching for Subject lines that are KNOWN to contain non-alpha characters
    Specfic examples:
    Subject starts with "[ABC..."
    Mail cannot find it if you search using "[ABC"
    Mail CAN find it if you search using just "ABC"
    Subject contains the numeral "2"
    Mail cannont find it if you enter "2" as the search string...even if you further constrain the search to "Subject contains: 2"
    Other problem characters I have found:
    The failure when using square bracket is a real pain since a lot of mailing lists are tagged using strings wrapped in square brackets.
    Sometimes it WORKS when I include multiple non-alpha characters in the search string, like "55" or "4/19"
    Anyone else see this?

    Please follow these directions to delete the Mail "sandbox" folder.
    Back up all data.
    Triple-click anywhere in the line below on this page to select it:
    ~/Library/Containers/com.apple.mail
    Right-click or control-click the highlighted line and select
    Services ▹ Reveal
    from the contextual menu.* A Finder window should open with a folder named "com.apple.mail" selected. If it does, move the selected folder — not just its contents — to the Desktop. Leave the Finder window open for now.
    Log out and log back in. Launch Mail and test. If the problem is resolved, you may have to recreate some of your Mail settings. You can then delete the folder you moved and close the Finder window. If you still have the problem, quit Mail again and put the folder back where it was, overwriting the one that may have been created in its place. Post your results.
    Caution: If you change any of the contents of the sandbox, but leave the folder itself in place, Mail may crash or not launch at all. Deleting the whole sandbox will cause it to be rebuilt automatically.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combinationcommand-C. In the Finder, select
    Go ▹ Go to Folder...
    from the menu bar, paste into the box that opens (command-V). You won't see what you pasted because a line break is included. Press return.

  • Whenever I try to access Google or Facebook I get a box with Chinese ? characters and another line of the same. ?

    This is what I get:
    您的网站未备案或为添加白名单
    此页面由傲盾防火墙自动生成
    The first line appears in a small yellow box with the other line in the body of the page. No other characters, although several of the characters are "highlighted" like they were a link

    I am not a Vista user. I am assuming the icons have changed to a firefox icon because you or; some application or other user; have set the default option for those file types to open with firefox.
    You will be able to change that in your registry settings but it is far safer to use some other option. I am not sure how to do that in Vista.
    RealPlayer.exe is an executable file, that is it is an application presumably a media player, if you try to open it with firefox; whicjch is what happens if you click its firefox icon; it will just give you the options to open or save the file. If you use the open option it may work as intended.

  • [PART SOLVED] Random j, k characters appearing on lines. A vim issue?

    Hi There,
    I recently noticed that when scrolling around a file using the keys j and k in normal mode that random j and k characters appear at the end of lines. Initially I thought this was a terminal issue so I switched terminals, no luck. I removed all erroneous crap from .vim, no luck. I have googled around a bit, and it appears this is a known issue with jslint, but this is occuring with no plugins. Ctrl-l removes the random characters, and they don't appear to be getting written to the file, but it is annoying non the less.
    Any thoughts?
    Thanks.
    Last edited by ZombieX (2012-05-25 12:36:50)

    Thanks for the reply. In my case, it appears more frequent when you scroll back and forth over pages using j and k. I haven't noticed anything with the 'O' command but I will keep an I out. I haven't been able to find the root cause of this, nor have I found any 'real' fixes so I either deal with it or use emacs with VIM bindings. I'll consider this closed.

  • Number of characters in a line of ABAP WD textedit

    Hi guys,
    I want to fix the number of characters you can write into the textedit component of my abap web dynpro. The problem is, that when i set cols to 73 ( that the ammount of characters i want to allow in one line) and then set the wrapping mode to hard or soft (makes no difference to me) there still is the possibilty of writing more than 73 characters into it. For Example when you input a line only containing 'i's : iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
    as these are very small, you can insert a lot of them.
    It would fix the issue, if you know the possibility of setting the font of the textedit. Than i could set it to a font were every character has the same width.
    Thanks in advance.
    Dave

    This had me bugged for ages, as my customer still wanted to display and maintain texts attached to infotypes (which are stored in PCL1(TX) with 72 chars in each line), as well as by a textedit box in WDA.
    Ended up (it's quite dirty, so look away now if you dont like that sort of thing)
    Implicitly enhance CL_WDR_MAIN_TASK->HANDLE_REQUEST and add (something like)
      data: lv_response type string.
      if wdr_task=>client_window->client->application_name cs 'ZWD'.
        lv_response = server->response->get_cdata( ).
        replace all occurences of '<textarea class=' in lv_response with '<textarea style="font-family:monospace" class='.
        if sy-subrc = 0.
          server->response->set_cdata( data = lv_response ).
        endif.
      endif.
    Works a treat for me
    Reg

Maybe you are looking for