Splitting Lines

Just wondering, using the scanner util to read from a file, parse the integer input, and sort it/output it etc. Problem is that I need it to sort line by line, instead it sorts everything in the file, any help appreciated.
Code looks like:
scanner = new Scanner(new FileReader(file));
               while (scanner.hasNext())
                    list.add(scanner.nextInt());
               }

Sinanju180 wrote:
Got ya, I've been looking but I can't find a method for scanner where I can read Line by Line, any suggestions?Scanner has nextLine() method which will read in each individual line. If you need to split this line further, you can use String#slit(" ") method or you can use a second Scanner object that is fed this line (just don't forget to close it when you're done with it else you could be using up valuable resources).

Similar Messages

  • How to adjust splitted lines into one line in Text file?

    Hi Guys,
    I have a text file with 3 fields(comma separated): GLCode (Number), Desc1 (Char), Desc2(Char) and need to load it into BW.
    My Text file looks like:
    1011.00,"Mejor PC Infrastructure","This line is ok."
    1012.00,"Telephone Equipment $","This line ends in next line.   
    1)Need to change the equipment immediately.
    2)Take immediate action"
    1013.00,"V1 Computer Server Infrastructure # Equip","For purchases
    of components that make up the company's network, such as servers, hubs, routers etc."
    1014.00,"Flash Drive","Need to provide all IT Developer"
    This is how file looks like. Now I need the followings:
    1. Need to remove the space and need to adjust the splitted line into one. Say here
    line/record 2 is splitted into 3 lines and need to adjust in 1 line.
    2. In Line 5 (Record 3) data splitted into 2 lines and need to make 1 line.
    3. Need to remove bad characters.
    Could someone help me please how to proceed ?
    Regards,

    Not quite correct by my testing.  Try:
    $i=0
    Get-Content .\test.txt | ForEach {
    If ($i%2){
    ("$Keep $($_)").Trim()
    }Else{
    $keep=$_
    }$i++
    Good catch!
    Boe Prox
    Blog |
    Twitter
    PoshWSUS |
    PoshPAIG | PoshChat |
    PoshEventUI
    PowerShell Deep Dives Book

  • Substitution of Split Line Items that appear only in FI - New GL?

    Hi,
    The new GL incorporation has brought in a functionality to automatically split user entered line items during GL Posting to create ledger balance at Profit Centre(or Company code) level in-case line items have multiple Pofit Centres(or Co.Code) etc.
    I have a requirement wherein I need to do substitution and validation of line-items created after splitting of document(which are visible only in general Ledge view of New GL). The line-items created after splitting don't show at runtime(ie during substitution using GGB1), we can only see user entered line-items that are present in BKPF and BSEG tables.
    Is there any way by which we can get hold of system created split line items that are present only in FAGLFLEXA/FAGLFLEAXT table for substitution/validation ?
    I need to substitute Transaction Type field BEWAR.
    Message was edited by: Tabishul Haque

    All ,
    As per SAP it doesn't allow substitution of fields after splitting of documents in new GL in case of Cross Profit Centre documents postings.

  • Using '\n' to split lines

    I've used '\n' to split lines of text but it doesn't work with all phones. Is there any other way to do it? I'm not using canvas.
    append("Title"+'\n'+"something");Edited by: Sypress on Mar 13, 2010 11:12 PM

    Use an array of length 2 to store the Strings or if they are related use a Map<String,String> or use Map.Entry if only a sing pair is required or create your own pair class, or ....
    The best approach though is to use an object to store them rather than relying on some delimiter and custom parsing method.

  • Batch split line in delivery

    Hi,
    In my system, I have configured automatic batch determination for my delivery item category.
    Now when the system determines the batch, even if there is one batch, the system creates a batch split line (with line number as 900001).
    Is this a standard system behaviour?
    Is there a way that we can have only one line if there is just one batch and go to a batch split line only when there are more than 1 batches.
    pls let me know. Any help would be highly appreciated.
    Thanks
    AB

    Hi Arijeet,
    please do the follow .
    SPRO: LOGISTIC EXECUTION->SHIPPING->DELIVERIES->DEFINE ITEM CATEGORIES
    Choose the item categories you use and check the flag "autobatchdeterm".
    Make sure that you have the right item category determination for the delivery type with Usage: CHSP (take delivery LF as an example). The path is:
    SPRO: LOGISTIC EXECUTION->SHIPPING->DELIVERIES->DEFINE ITEM CATEGORY DETERMINATION.
    Then you have to activate the ATP check in delivery process:
    SPRO: SALES..->BASIC FUNCTION->AVAILABILITY..->AVAILABILITY CHECK->AVAILABILITY CHECK WITH ATP LOGIC->CARRY OUT CONTROL...
    you have to check the configuration for the combination:
    CH Batches - B SD delivery and
    02 Individ.requirements (if you use it in the MRP of you material master) - B SD delivery.
    if you give me brief i can help you out more.
    Thank you .
    Regards
    Ram

  • Om split line not split the charge

    the stardand split sales order line(Sales Orders/line items/Actions/Split line) will split the charge,but my customer hope not split the charge. please help me!!! thank you

    Unfortunately there is no way currently to make split view the default for any server-side page. Your best bet would be to post an idea on the Ideas tab (or support one that is already posted).

  • " split line on apple logo on startup screen?"

    Why is there a split line on apple logo on startup screen?

    If you are talking about the curved line, it just looks like that is how they made it.

  • SO order line haven't split line automatic when shipped with backordered

    Hi
    The order line qty 1300 for SO ,and inventory have only 800,after pick release and do shipconfirm. The order line haven't split lines and status is still awaiting recipt
    when find the shippment transaction, input status 'interfaced' and 'order line' can find qty 800 ,and input status 'noshipped' and the same 'order line' can find qty 500
    Could you help me why?
    Thank you very much

    Thank you very much ,setup shipping tolerance as zero but not OK, for this SO have many order lines ,but only this order line can't split

  • AR- Invoice- splitting line item positngs

    Hello,
       we have a scenario in the AR invoice. The business invoices the customer on a weekly basis, for the week at month-end few days if the week fall into the next month( for e.g Oct 28th week , thursday and friday fall into Nov month, they want that all the revenues to be automatically split on the same Invoice and fall in the appropriate period.
    Personally I don't think there is posting date on line item , if we invoice it in nov then the total amount will post to november period.
    Can anyone provide any inputs or some work around to split the line items month-wise on the same invoice.
    thanks in advance.

    Win:
    This issue should actually be resolved by an SD consultant. It is outside FICO domain.
    For your scenario you need to modify "Billing Plan/Invoice Plan Type" which is configured in  SD > Billing > Billing Plan > Billing Plan Type.
    There are some options available in that config settings that should fulfill your needs for eg:
    In
    Milestone billing (a billing type) - the total value to be billed is distributed between the individual billing plan dates (the value billed on each date can be fixed amount or a percentage). I believe this should take care of your issue. You may need to get in touch with your Sales & Distribution team for configuring settings to satisfy your scenario.
    You can find some descriptive notes on this under:
    SD > Billing > Billing Plan, just read the documentation available to get a hang of the issue.
    Vj
    Assign points if info helps!

  • MIRO : split line item into multiple

    I have senario were we need to split 1 PO line into multiple line items in MIRO due to different tax applicable for different amounts....

    Hi,
    How same material from same vendor with same time in a single PO have different tax structure?
    You have following options, chose your suitable one:-
    Option-1
    Create single PO with 10 qty and do not enter tax code in PO. Do invoice 2times for your PO ie.. invoice with 4qty with value 400 for  tax code XX and again invoice with 6qty with value 600 for tax code ZZ
    Option-2
    Create single PO with two line items……1st line item with 4qty & value 400 with  tax code XX and 2nd line item with 6qty & value 600  with  tax code ZZ. Do invoice directly for that PO.
    Option-3
    Create two PO separately ie….. One PO with 4qty with value 400 with tax code XX and Another PO with 6qty & value 600 with tax code ZZ. Do invoice two PO’s
    Regards,
    Biju K

  • ALV download to local file, splits line in two

    Dear Abapers,
    I have a quite wide ALV report, when downloading to local file, I get the "long" line splitted in 2 (in case of spreadsheet format) and in 3 in case of unconverted format.
    Is there a turn arround in order to have only one line?
    It's not an excel limitation, once there are enough columns to paste the "lower" part of the line on the right of the "upper" part.
    Thanks in advance.
    FLP

    Hi,
    I download the report, pressing the "Local File... (CtrlShiftF9) icon on the ALV, after I choose "Uncoverted" or "Spreadsheet" radio button. If by "Excel in place" you mean press the "Microsoft Excel" icon, for some stransge reason, on my pc and some other users this doesn works, nothing happens or a blank spreadsheet is opened, if you mean something else, plese revert, once I didn't understand it correctly.
    Thanks in advanve
    FLP

  • Split line in File posted

    Hi
    I am facing rather a unique problem. I have a report that generates a file and posts it on the application server. When i open the file at the application server it shows me line split ( I mean a new line is introduced in the middle of a row).
    On further investigation I observed that the field after which it split contains a # symbol. Now many files posted on the server contains # but this problem is not observed in any of those files.
    I tried replicating this on quality and dev by adding # at run time in debug mode but the file posted is perfectly fine.
    Please share your thoughts on this.
    Preethi

    Hi Preethi,
    If you see the file on application server in AL11 instaed of sapce you can see there as #.
    So in AL11 use MENU as
    LIST--->SAVE/SEND-->FILE   and select the file format (Txt,exce,.........etc)
    See in the downloaded file wheather you are getting and #.
    Regards,
    Pravin

  • Split line/tone Pantone swatches of same color look different

    QUESTION: In Illustrator I need to split a Pantone color into two different swatches (line and tone). When I duplicate the swatch and rename it with an "L" in front, the color looks different (with overprint preview)! Same CMYK values – I checked. I know it has something to do with how the swatch is named, because if I rename both swatches I don't have this problem. What's going on and how can I fix this?

    John Danek wrote:
    Not sure, but I would not recommend renaming Pantone Spot color swatches.  What's the point?  I mean, why would you mess with the names?
    I think they wants to use one swatch for certain parts of elements like the stroke and and perhaps the other for fills but of different and not necessarily common paths.
    Changing the name make it easier for them to know which is applied to the other. There coud be a reason to keep them separate and to have the names be different to make the work flow effiecient.
    I think the reason is that since they are now two different swatches it treats it as two different inks one from the book and the other from a CMYK mix.
    It simply does not recognize the second swatch as a book color which would have to be a second plate with the same ink.
    You cannot rename a book color.
    So unless you were planning to hit the piece with two plates with the same spot color what you want to do is not possible.
    I can see where you want this but I see no way of fixing it except a feature request.
    Perhaps placing the same swatch in two different color groups?

  • Split lines in Table painter

    Hi Guys
    I have to split a line in a table painter in smartform, which I did by right clicking the mouse and choosing split from the context menu.
    1. But the problem is that It does not show in the output
    2. Even if it shows, how do I put data in it?
    Thanks for reading .

    Hi,
    Once you split the line.. you need to select the cell containing the line you just split.. and look for little icons on the top menu that look like boxes that are used to create borders.. click on the appropriate one depending on where yu want a line to be drawn.. yu could draw all four sides or just one side depending on what you want.
    Putting data in it.. you need to double click on the text node that has the data yu need to display on the smartform.. under the output options tab.. right at the bottom you will see column and row boxes.. so this is where you need to specify the column and row number of the table.
    Hopefully this helps!

  • Sales order split line user exit MV45AFZZ

    Hi Guys.
    Requirement is to split the sales order line items into multiple based on certain requirement. I Started coding in MV45AFZZ (USerexit_Save_Document_Prepare).  Basically what i am doing is looping at XVBAP and based on some condition inserting additional line in XVBAP and adding a new line with new UOM and incrementing the POSNR.). The data seems to be ok to me. But when i save i am getting update terminated error.  Can anyone help me out ?
    Thanks
    Vikram.

    Hi,
    Ary you using any 'COMMIT WORK' there?? If yes, that may cause this kind of error. Appending the records in XVBAP with mandatory fields should work.

Maybe you are looking for

  • Can I Export My Mail Accounts?

    How can I export my Mail accounts so that I can easily Import them back into a new user account? (Complete with all of the proper email details like smtp stuff.) Thanks

  • NI-MyRIO Analog Inputs

    Greetings, I'm just getting the myRIO up and running, and I'm sort of disappointed that the +/- analog inputs are differential only. Is there any low level way to use these channels differently, or at least each as single-ended? Pseudo-differential,

  • Webview: Maximum Wait Answer Time or Longest Call in Queue Fields or operation

    Hi, Currently have a cutsomer who needs custom reports, on the customization he requieres to place on a historic basis a field which he calls Max Wait Ans, this field refer to the Maximum time a caller waits for an agent to answer the call or the sam

  • My iPhone 3GS won't connect to the internet.

    I updated my iPhone just now to iOS 5.1 and now it won't connect to the internet/apps via 3G; I also cannot retrieve mail.  My messages are now also sending as normal SMS and not iMessage please help.

  • Satellite P100: Memory Stick Duo Pro with MSD adaptor is not recognized

    When I insert MSDP in the multi card reader of my Satellite P100-473 - Vista preinstalled - (using a MSD adaptor), the Removable media is listed in the Explorer but the card cannot be read. With a 32MB card, it reports that card should be first forma