Split() questions

I have tried to read regular expression (regexp) tutorials but I don`t really see how to do what I want. What I want is to have "One" printed above "two" and that printed above "three" without doing System.out.println(temp.trim()); in the for-each loop. Firstly, how do I use *?* versus *|* ? Secondly, I know that the argument is a regular expression and that I must use regexp to do what I want but I am not getting it. The results I get are "One" above whitespace followed by "two" then that on top of "three".
public class SplitTokenizingClass
    public static void main(String[] args)
        String str = "One,           two,three";
        for(String temp: str.split(",|,\\s")) // also why doesn't split(",").trim() work for example? (generally speaking)
            System.out.println(temp);
}Any input would be greatly appreciated!
Thanks in advance!

s3a wrote:
Okay, I see. But, just to make sure that I understand the terminology: +, |, *, and ? (without the commas) are regexp quantifiers instead of java operators?
Edit: Actually, | is NOT a quantifier? Correct, only &#43;, &#42;, ?, {m}, {m,} and {m,n} +(where m and n are numbers and m <= n)+ are quantifiers.
s3a wrote:
Can someone please elaborate on the terminologies here?Sure:
A*   // matches zero or more 'A's
A|B  // matches either 'A' or 'B'
A+   // matches one or more 'A's
A?   // matches 'A' once or none at allNote that the '?' placed directly after a quantifier, it has a different meaning. See: [http://www.regular-expressions.info/repeat.html] for more details about that.

Similar Messages

  • Message split questions

    Hi Guys!
    First I need a confirmation for following assumption:
    To create multiple messages of same type (without BPM) I set the inbound interface to 0..unbounded in the if-mapping and I also set the target message to 0..unbounded in the message mapping. If I want to create one message per let's say "ITEM", I map ITEM to the root node of the target message and there will be one message per ITEM. Is that right?
    Then I have a question concerning the processing order:
    Are the messages processed in the order they appear in the message mapping?
    Last question:
    Does the message split within the if-/ message mapping also work with synchronous processes and with jdbc adapter?
    Thanks in advance!
    Karsten

    Karsten:
    In anwsering your first question, it is 1:N multi-mapping scenario, noticed that your target message is just single type.
    1. In your message mapping, go to "message" tab, change your target message to 0:unbounded
    2. In you Interface mapping, change to inbound interface to 0:unbounded, mapping program need to be specify your message mapping
    3. In your message mapping, you want each 'ITEM" in your source message to generate each target message:
    you need to map: ITEM  --->  Target_Message_Type.
    Hope this answer your first question as well.
    Liang

  • Document splitting question

    Hi ,
    can some one explain me the concept of document splitting when it comes to cross company code..how does document splitting work when a document has two company codes or for a cross company document..pls give a small example..
    *help me out...looking forward for some inputs and appreciate your help
    Thanks in advance.
    Sai.
    Edited by: fico sap on Mar 3, 2008 5:52 PM

    Hi,
    Settings provided in document splitting rules are all standard sap ones.
    Please use document splitting method 0000000012 and dont change any of the base item and item category.
    Only make the following updations in document splitting node in SPRO:
    a) Classify G/L accounts for document splitting
    b) Define Zero balance clearing account
    c) Define Document splitting characteristics for General Ledger Accounting and ensure to select profit center and segment as zero balance and mandatory field as ticked.
    d) Activate document splitting
    Apart from these, it is not necessary to change any of the document splitting details.
    Assign points if useful.
    Regards,
    Dwarak.

  • File-XI-File BPM Split Question

    Iam using BPM to split the 1 file into 2 files. I have to use BPM due to requirement.
    Iam sending file to BPM
    In BPM:
    receive step
    transform Step - Here message split is performed
    Fork Start
    Send Message 1
    Send Message 2
    Fork End ( end condition is 1=1 )
    Stop.
    Only 1 file is written and 2nd file no information
    When I looked at SXMB_MONI_BPE
    Send1 Workflow system logically deleted
    Send2  Workflow system completed
    I dont know whats happening for Send 1
    Where can I look for potential errors ?
    In the request message mapping of SXMB_MONI ( 2 payloads are as follows )
    1st Payload ( Maindocument ( Application/xml))
    <?xml version="1.0" encoding="utf-8" ?>
    - <ns1:MT_State xmlns:ns1="http://www.test.com">
    - <State>
      <State_rec>NYC</State_rec>
      <State_rec>FLA</State_rec>
      <State_rec>CAN</State_rec>
      <State_rec>CAS</State_rec>
      </State>
      </ns1:MT_State>
    2nd Payload (XI_Context(text/xml))
    <?xml version="1.0" encoding="utf-8" ?>
    - <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    - <asx:values>
    - <CONTEXT>
    - <RMS_CONTEXT>
      <NAMESPACE>http://sap.com/xi/XI/System</NAMESPACE>
      <NAME>ProcessStep</NAME>
      <VALUE />
      </RMS_CONTEXT>
      </CONTEXT>
      </asx:values>
      </asx:abap>
    Anyone have any suggestion for me how to fix this issue?
    Thanks a lot.

    Ram,
    Since Iam going to add more process steps ( such as synchronous calls) i really wanted to finsih the sending of both SEND steps in the FORK. If I dont give end condition, am I sure that those SENDS are processed before next process step following fork ?
    BPM will come out of FORK only when all steps in all branches are executed succesfully.
    If you give an END condition to the fork, then this is used when you are not sure for how long the steps in the fork should run, and so on.
    http://help.sap.com/saphelp_nw04/helpdata/en/24/e2283f2bbad036e10000000a114084/content.htm
    +You use a fork () when you want to continue a process in branches that are independent of each other, for example, to communicate with two systems that are independent of each other. The branches of the fork join in a union operator.
    You can specify the required number of branches and then define whether the process must run through all branches, or just a particular number of branches. Furthermore, you can define an end condition for the fork (see also: Condition Editor).
    As soon as a branch reaches the union operator at runtime, the system checks the following conditions in the specified order:
    · The process has run through the required number of branches
    · The specified end condition has returned true
    The step is complete as soon as one of the conditions returns true.+  
    Earlier when you gave condition as 1=1 one of the steps was executed and it came out of the fork. So, do no give any condition and it will execute all steps in the FORK and come out as you want.
    Regards,
    Bhavesh

  • Array.split question

    Hi,
    Curious, can you split a file when using array.split() for a
    carriage return that was loaded using loadVars?
    say my file looked like this:
    John, 23, handsome, blonde
    Mary, 35, pretty, brunette
    myArray[3] = blonde Mary
    is there a way to have it
    myArray[3]= blonde
    myArray[4]= mary
    any help would be great.
    thanks,

    Ya, split a string sorry.
    I've used the loadvars to load a file.
    John, 23, handsome, blonde (line returns w/no comma
    seperator)
    Mary, 35, pretty, brunette
    var myArray:Array = myStr.split(",");
    gives me
    myArray[0] = John
    myArray[1] = 23
    myArray[2] = handsome
    myArray[3] = blonde Mary (here's the problem)
    myArray[4] = 35
    myArray[5] = pretty
    myArray[6] = brunette
    I need to split the string where the file had a carriage
    return/new line.
    Is that possible?
    Thanks,

  • PIR Split Question

    Dear all,
    If the monthly planned independent requirement has been splited to daily, how can I roll it back?
    Shall I need to transfer the requirement via MC8G again?
    BTY, the requirement seems be splited automatically, what configuration I should check to prevent that occur again?
    Thanks in Advance

    Dear,
    Go to MD62 and select the perticular material or materials and then goto-- edit and period splitting and select Month.
    In MD62, Schedule line tabl page specify the split as Monthly (M).
    Then MRP will consider generate planned orders monthly
    Please refer this laso,
    Re: Requirement
    Regards,
    R.Brahmankar

  • Possible "split" question?????

    Post Author: llcoolt
    CA Forum: Formula
    I have a field that returns lastname,firstname.  How can I return JUST the last name?
    Thanks for the help.

    Post Author: SKodidine
    CA Forum: Formula
    split({table.field},',')&#91;1&#93;;

  • Invoice Split due to incoterms Part 2

    Hello SAP experts..
    Kindly advise on the follwing issue.
    In delivery related billing I am having Incoterms part 2 as By ROAD in payer custoer msaster.
    In the sales order also I am having the same incoterms 2.
    But at the time of delivery, due to some reasons I am chaing it to BY TRAIN or BY AIR,.
    This is resulting in invoice split. In the split analysis it is showing ' header data different- incoterms part 2"
    we do not want the invoice split even after chaning the incoterms part 2. Also do not want to change the incoterms in customer master also.
    Kindly adivse on the same//
    Regards
    RaviRaj0308

    Hello SD Experts
    I am explaing the situation here again,,,,,
    1) We have document flow like this. Order- Delivery- Invoice- supplementary order- supplementary invoice
    2) We make the supplementary order with ref to Invoice which could be more than 1 sometimes. So these invoice might have different incoterms 2.
    3) We make & save the supplementary order & save it.
    4) then we make invoice with ref to this supplementary order, which is getting split, which we do not want.
    5) Also the split analysis says " different header data- incoterms 2"
    Question 1) How to restrict the "Invoice Split"
    Question 2) If not possible through the settings, which user exit/ development I should ask to ABAP team.
    Fell free to ask further queries.
    Thanks & Regards
    RaviRaj0308
    Edited by: RaviRaj0308 on May 26, 2011 1:24 PM

  • Invoice Split due to different incoterms 2

    Hello SD experts..
    Kindly advise on the following situation.
    we are making supplemetary invoice with  ref of invoice which could be more than one sometimes.
    Further more in first invoice we have put incoterm 2 as a BY ROAD. In 2nd inovice we have put incoterm 2 as BY TRAIN & in 3rd it is BY AIR.
    So when we try to make supplementay invoice with ref to these 3 invoice ( we want to make only 1 supplemetary invoice) it is getting split saying " different header data- Incoterms 2"
    What settings I have to change.?
    Thanks & Regards
    RaviRaj0308

    Thanks Arun for paying attention towards this...
    I will explain the situation again.
    1) We have document flow like this. Order- Delivery- Invoice- supplementary order- supplementary invoice
    2) We make the supplementary order with ref to Invoice which could be more than 1 sometimes. So these invoice might have different incoterms 2.
    3) We make & save the supplementary order & save it.
    4) then we make invoice with ref to this supplementary order, which is getting split, which we do not want.
    5) Also the split analysis says " different header data- incoterms 2"
    Question 1) How to restrict the  "Invoice Split"
    Question 2) If not possible through the settings, which user exit/ development I should ask to ABAP team.
    Fell free to ask further queries.
    Thanks & Regards
    RaviRaj0308

  • Supplementary Invoice Split Due to Incoterms 2

    Hello SD Experts
    Kindly advise on the following situation.
    1) We have document flow like this. Order- Delivery- Invoice- supplementary order- supplementary invoice
    2) We make the supplementary order with ref to Invoice which could be more than 1 sometimes. So these invoice might have different incoterms 2.
    3) We make & save the supplementary order & save it.
    4) then we make invoice with ref to this supplementary order, which is getting split, which we do not want.
    5) Also the split analysis says " different header data- incoterms 2"
    Question 1) How to restrict the "Invoice Split"
    Question 2) If not possible through the settings, which user exit/ development I should ask to ABAP team.
    Fell free to ask further queries.
    Thanks & Regards
    RaviRaj0308
    Edited by: Lakshmipathi on May 25, 2011 8:09 PM
    Thread Locked
    Reason - Posted in multiple forums

    Hope this document will help you
    http://saptechsolutions.com/pdf/SDBillingDocumentConsolidationAndSplit.pdf

  • SSL VPN Full and Split Tunnel Config Question

    I am Beta testing SSLVPN on an IOS router. The question I have is this:
    Is it possiable to have slit and full tunnel configs. It seems that once you create your context and default profile that is all you have either split or full. The books say you can use Radius and assign different profiles but, I would like to give the users a choice (like in the VPN3000 .pcf) of either split or full depending on where they are working from.

    The below is an example using the ASA - but the principle remains the same:-
    http://www.cisco.com/en/US/customer/products/ps6120/products_configuration_example09186a0080975e83.shtml
    HTH>

  • After trying to backup  my hard drive i can't get my G4 quicksilver to boot. I get the old icon of a folder with a split face that alternetes with a flashing question  mark

    My G4  won't boot. I have tried holding down the c key to boot from a 10.3 disc and it doesn't boot. I keep getting the icon of a folder with a split face that flashes to a question mark. I know that usually means that the startup drive can't be found, but I have 2 good drives i have tried to boot with and it won't start up. Any ideas from out there/ Thanks in advance.

    I doubt it's CCC's fault, possibly a bad DIMM, or slot, or corrosion in the slot.
    How large is the drive? Which G4? Some can only handle 128-123 GB Drives. Is it an old drive?
    So we know more about it...
    At the Apple Icon at top left>About this Mac, then click on More Info, then click on Hardware> and report this upto but not including the Serial#...
    Hardware Overview:
    Model Name: eMac
    Model Identifier: PowerMac6,4
    Processor Name: PowerPC G4 (1.2)
    Processor Speed: 1.42 GHz
    Number Of CPUs: 1
    L2 Cache (per CPU): 512 KB
    Memory: 2 GB
    Bus Speed: 167 MHz
    Boot ROM Version: 4.9.2f1
    If you don't know the model, find the Serial# & use it on one of these sites, but don't post the Serial# here...
    http://www.chipmunk.nl/klantenservice/applemodel.html
    http://www.appleserialnumberinfo.com/Desktop/index.php
    How to find the serial number of your Apple hardware product...

  • Splitting file names using delimiter question

    I have a very simple question. I am trying to set the variable $fnameYear to whatever is after the third '-'. My problem is that if there is a space in the name it wont work correctly. How can i use a delimeter so that it splits after the '-' for only 4
    characters?
    $fnameYear=(($_.BaseName -split '-')[3])

    This should work:
    $_.BaseName.Split('- ',[System.StringSplitOptions]::RemoveEmptyEntries)[3]
    ¯\_(ツ)_/¯

  • Split Directory Packaging and Deployment Question

    Hello Rob Woollen and All,
    I have a question about packaging and deployment with the "split directory structure"
    in WebLogic Server 8.1.
    Specifically, how does one go about deciding which classes to put in myEnterpriseApp/myWebApp/WEB-INF/classes,
    versus myEnterpriseApp/myEjbModule, versus myEnterpriseApp/APP-INF/classes?
    I think the answer to the first part is easy enough: if there are classes depended
    on by, say, the servlets in a web app, but not depended on anywhere else in the
    enterprise app, then those classes should go in WEB-INF/classes.
    It's the other part of the question that gives me trouble. I use local interfaces
    on my session beans. Let's say I have a domain object class returned from a session
    bean method and depended on by the web app. If I put that domain object class
    under myEnterpriseApp/myEjbModule, then the web app can see it by virtue of the
    classloader arrangement.
    But the wlcompile Ant target supposedly compiles stuff to build/APP-INF/classes.
    What stuff? How does it decide? I haven't experimented and empirically observed
    yet, but I couldn't find the answer in the documentation and tutorials. Is it
    looking for java source files under src/myEnterpriseApp but not under myWebApp
    or myEjbModule? In general, does BEA have any recommendations in this area?
    Thanks,
    Randy

    "Randy Stafford" <[email protected]> wrote in message
    news:[email protected]...
    >
    Hi Mark,
    Thanks for the reply. I don't have 8.1 installed yet, so I can'tempirically
    observe the example's behavior. But I downloaded the example andinspected the
    code. It answers some, but not all, of my questions.Where to start.
    In 8.1 we have made optimizations to J2EE packaging. Mostly this is about
    not having to use manifest classpath's to do sharing of of common classes.
    MF Cp's are a pain to configure. You put your classes in one location in
    the ear and then EVERY module has to have a MF CP entry pointing to that
    location, and then you actually have N number of classes loaded per module.
    The mechanism to share classes across all modules is APP-INF/lib and
    APP-INF/classes. The benefit is that APP-INF is shared across all modules.
    So to your question below you could just put it in the EJB module, BUT if
    you have mutliple EJBs that you split into seperate modules your back tot
    the same issue. So APP-INF is just the simplist solution over-all.
    Split-dir is a specified way to lay out disk your src files
    Split-dir
    From code inspection, it looks like the JSP and EJB (therefore the web appmodule
    and EJB module) both depend on the AppUtils class, which is not inAPP-INF, but
    rather in a directory under the enterprise app directory that does notrepresent
    a web app module or EJB module. In the build file's compile target, is itthe
    wlcompile task invocation that causes compilation of AppUtils.java? Or isit
    the ant task invocation (with "build.appStartup" as the value of thetarget attribute)
    that causes compilation of AppUtils.java due to the dependency ofApplicationStartup
    on AppUtils? And what subdirectory of the build directory doesAppUtils.class
    end up in?
    Why not just put AppUtils.java in the EJB module? Both dependent moduleswould
    still be able to see it by virtue of the classloader arrangement. Doesputting
    it in outside of all dependent modules represent a convention that BEArecommends?
    >
    Finally, why not put applicationresource.properties in the same place asits user
    AppUtils.java?
    Thanks,
    Randy
    "Mark Griffith" <[email protected]> wrote:
    Randy:
    (Rob may post later, but here is my take)
    "Randy Stafford" <[email protected]> wrote in message
    news:[email protected]...
    Hello Rob Woollen and All,
    I have a question about packaging and deployment with the "split
    directory
    structure"
    in WebLogic Server 8.1.
    Specifically, how does one go about deciding which classes to put inmyEnterpriseApp/myWebApp/WEB-INF/classes,
    versus myEnterpriseApp/myEjbModule, versusmyEnterpriseApp/APP-INF/classes?
    I think the answer to the first part is easy enough: if there are
    classes
    depended
    on by, say, the servlets in a web app, but not depended on anywhereelse
    in the
    enterprise app, then those classes should go in WEB-INF/classes.
    It's the other part of the question that gives me trouble. I use localinterfaces
    on my session beans. Let's say I have a domain object class returnedfrom
    a session
    bean method and depended on by the web app. If I put that domain
    object
    class
    under myEnterpriseApp/myEjbModule, then the web app can see it by
    virtue
    of the
    classloader arrangement.
    But the wlcompile Ant target supposedly compiles stuff tobuild/APP-INF/classes.
    What stuff? How does it decide?wlcompile has a module factory. If a directory is claimed by a module
    factory then it is compiled by that specific module compiler. The rules
    for
    module definition follow the same J2EE formatting rules.
    So:
    /myejb/
    would be identified as a ebj module by:
    */myejb/meta-inf/ejb-jar.xml
    */myejb/myejb.ejb (EJBGen file)
    then src files (*.java) will be compiled to
    $BUILD_DIR/myejb/
    /myweb/
    would be identifid as a web module by:
    */myweb/WEB-INF/web.xml
    Also for webapps
    /myweb/WEB-INF/src/*.java
    will be compiled ot
    $BUILD_DIR/myweb/WEB-INF/classes
    We choose WEB-INF/src following the struts precedence.
    So a plain old module that has noting but .java files in it will go to
    $BUILD_DIR/APP-INF/classes
    If you have a jar of classes that you need to share across the entire
    ear,
    you would check it into your src tree at:
    $SRC_DIR/APP-INF/lib/mycommon.jar
    You can check out an example at:
    $BEA_HOME/weblogic81/samples/server/examples/src/examples/splitdir/helloWorl
    dEar
    Hope this helps.
    cheers
    mbg
    I haven't experimented and empirically observed
    yet, but I couldn't find the answer in the documentation and tutorials.Is it
    looking for java source files under src/myEnterpriseApp but not undermyWebApp
    or myEjbModule? In general, does BEA have any recommendations in thisarea?
    Thanks,
    Randy

  • OSB Split Join Repeat Until Question On XPath Condition

    I'm trying to use OSB File Transport to stream a very large XML document file into a service which will split the file into very many small XML documents. So, given a file like:
    <BookStore>
    <Book></Book>
    <Book></Book>
    ... (many more books)
    </BookStore>
    In the split join I want to use a 'repeat until' to process each Book until there are no more Books in the BookStore. Here's my question: What is the correct XPath expression to use as the Repeat Until terminating condition? (I'm an XPath novice.)
    Thanks for your help!!!

    Hi,
    Based on what I understood, you should be using a for each loop with the conditions as follows:
    Within the Split Join flow
    for each ( counter variable from 1 to Count (xpath of book) ) --> For my example it was count($request.parameter/sjpoc:Orders/sjpoc:Order) replace this with your xpath.
    - do your logic
    Snapshot just in case @ http://dl.dropbox.com/u/19901533/sj_foreach_snapshot.JPG
    Based on this the split and join would happen for n (based on count) number of Book tags.
    Let me know if my understanding is incorrect.
    Thanks,
    Patrick

Maybe you are looking for

  • 10.4.6 won't sleep or run screen saver

    After upgrading my mini to 10.4.6, it will not sleep the screen or spin down the disks, and the screen saver will not run. Other than this, everything is fine. Any advice, anyone?

  • Address Book: How do you select, copy and paste info to an email?

    I look up a contact in my Mac Address Book and want to cut and paste email/address and phone into an email I am writing in another application - in this case using AOL online. It seems that you cannot select and paste the information or selected part

  • Button Layer

    Hello, Having trouble figuring out what the correct actionscript for a button that is trying to access a labeled frame within a movie that is part of a larger movie. It works if I play it by itself outside of the larger movie, but I'm not sure how to

  • Why is Black more expensive than white?

    There is 2 whitemac books! Then a black one! Why does the black cost more than the high end white? Is one made of metal and the other one made of plastic? Are macbooks durible or more durible than the MacBook pro?

  • Shockwave Player Version

    Hello, I have inserted a Director Shockwave movie into my site by clicking on INSERT--MEDIA--SHOCKWAVE--MOVIENAME. When I preview, I get the following error message: "This page is referenced to an incorrect version of Shockwave". I have the most rece