How to find the ocuurence of a word from LIST A in LIST B in a text file?
Hey if you look at the text file there is LIST A and LIST B.. i need to find the ocuurence of a word from LIST A in LIST B. Eg: if my output is (1,3)
then first word from LIST A occurs in 3 places in LIST B.
Can you please get the sample code to do this process.
Please let me know..
My text file looks like this below :
phrases.txt
LIST A
aamsz
abaffiliate
aboard casino
above computer
above pop
above violat
LIST B
http://209.153.231.131
HTTP/1.0 200 OK
Server: Microsoft-IIS/5.0
Date: Mon, 02 Feb 2004 11:53:26 GMT
IISExport: This web site was exported using IIS Export v2.2
IISExport: This web site was exported using IIS Export v2.2
Content-Length: 274
Content-Type: text/html
Set-Cookie: ASPSESSIONIDSSDBBBAR=OOGFKOJBMKMDCGPIHPADALHB; path=/
aboard casino
Cache-control: private
abaffiliate
above computer
The key difference is that Vector is synchronized whilst ArrayList is not. Synchronized means that the classes methods can safely be accessed by different threads and as your application will not be multithreaded then the ArrayList is possibly the better option.
To store Strings in an ArrayList, you first need to declare the ArrayList object something like this;
ArrayList<String> listAList = new ArrayList<String>();and you would obviously do something similar for the ArrayList that will hold the Strings that should belong to List B.
The first thing to note is that you can use the new (well new in version 1.5 anyway) generics techniques to specify the type of the object the ArrayList will hold; Strings in this case.
To add a value into the ArrayList once you have read it from the file and decided if it belongs in the List A or List B ArrayList, all you need to do is call the add() method of the ArrayList something like this;
// Assume that you read the line from the file into a variable called temp;
listAList.add(temp);To compare the two lists, the easiest option would be to iterate through one ArrayList and ceheck to see if the values you recover from it are duplicated in the other ArrayList. Luckilly, ArrayList has another method that helps here, it is called contains();
Assuming that you have two ArrayList(s), one called listAList that holds the Strings that belong to List A and another called listBList that holds the Strings that belong to ListB, you could do something like this to check for duplicates;
for(String element : listAList) {
if(listBList.contains(element)) {
System.out.println("Found a match");
}Hope that helps.
Similar Messages
-
How to find the number of fetched lines from select statement
Hi Experts,
Can you tell me how to find the number of fetched lines from select statements..
and one more thing is can you tell me how to check the written select statement or written statement is correct or not????
Thanks in advance
santoshHi,
Look for the system field SY_TABIX. That will contain the number of records which have been put into an internal table through a select statement.
For ex:
data: itab type mara occurs 0 with header line.
Select * from mara into table itab.
Write: Sy-tabix.
This will give you the number of entries that has been selected.
I am not sure what you mean by the second question. If you can let me know what you need then we might have a solution.
Hope this helps,
Sudhi
Message was edited by:
Sudhindra Chandrashekar -
How to find the job and job status from RSPCM
hi all,
suppose we got an error and in rspcm the process was failed.i want to know the status of that particular job.and if any i want to stop that job in SM37.
plz tell me how to find the job and job ststus from RSPCM...and how to stop that job in SM37
thanks,
jackHi Jack,
RSPCM: T.Code
This transaction is used to monitor the process chains
First:
here you need to add the process chains into the sheet
Second:
Then you can monitor the process chains in this transaction code
Like you can see the : status ,proces chain ,Last run date ,Last run time ,Log ID
Status : Green when sucessful,Yellow when running & Red when you get errors
Now when yoy click on any of the process chain in RSPCM you will go to the LOG VIEW as you see in RSPC transaction
SM37:T.code
This transaction is used for Job Overview
you can see many options in SM37
like Released,active,cancelled,finished,etc
Just select the ACTIVE jobs and also pass STAR in JOB ID & USER ID
here you can only see the active jobs
Goto Step in toolbar
select the program displayed
then chose option GOTO - Variant in main menu bar
in the variant you can see the job belong to which Process chain
if you want to cancel this job come back to SM37 Display screen
Select the Job and select the JOB DETAILS tab in Tool Bar
Collect the WIP ( Work Permit ID)
Go to SM50 T.code and find the WIP
in Main Menu Bar you find the option Cancel with Core choose this it will cancel the Job
Regards
Hari -
How to find the table in which data from a structure sits
Hi,
I want to know how to find the exact table where data sitting in various structures during runtime are stored.
For instance,in ME23N we have various tabs and data in those are held in various structures. This we can see by checking the technical setting of each field.
I want to know in which table the data is actually stored for each field and how to find them.
Any other means other than using "WHERE USED" option?
Thanks
CMAfter checking for technical field from the screen, when you reach out to structure, you can dbl click on the particular field's data element. From this data-element you can get to know in which tables it is used. Also if the data element refers to some master data field then you can check out its domain and in the domain you can refer the<b> value table</b> for that domain. This is what i will do if i am not sure about anything.
Hope it will help a little.
Jignesh. -
How to find the user exits and BADIS from SPRO
Hi all,
please let us know how to find the User exits or BADIS for an application from SPRO.
Regards,
MadhaviHi Varisetty,
Finding user exits and BAdis from SPRO can be cumbsersome. In most instances you know the standard SAP program and want to check (find) an exit called in the flow of the transaction. You can do this as follows:
For User Exit:
Put "/h" in the command box (to start debugging)
Execute your transaction
When you enter debugging - put a breakpoint at statement
CALL CUSTOMER-FUNCTION
the control will stop at all calls to User Exits
For BAdi (it's simpler)
Go to class CL_EXITHANDLER in SE24
Enter method GET_INSTANCE
Put a breakpoint in this method
Run your standard transaction - control will stop at all BAdis called within the flow since this method is used to check BAdi implementations before invoking them
Also, if you want to find enhancements by package - go to SE80, enter the package and check function groups starting with X - those contain function exits (conventional user exits). For BAdis in a package, there is normally a separate tree node (under the package) for Enhancements hence clearly identifiable.
Cheers,
Adi -
How to find the occurrence of a word
Hi...how can i write a method to find the occurrence of a string......
i was thinkin of using an arraylist...but is there another way of doing it without an arraylist?
thanksDo you mean the occurence of a string in a DOM tree, an XML document, some other file on disk or in another String.
For the latter, it is pretty easy...int startAt = 0;
int count = 0;
while (startAt != -1 ) {
if ( (startAt = myString.indexOf(searchString, startAt)) != -1 ) count++;
} -
How to find the OBIEE report (Catelogue) path from BI enabled excel sheet
Dear All,
I have an excel sheet where the data is coming from BI server. How can I find the BI report name and path from the excel sheet.
Regards
MustafaSorry Friends,
May be I am not conveying the message properly.
Let me try to do it again.
I have an excel sheet which is created by somebody else and send me by mail.
This excel sheet is having connectivity to the BI server and pulling data from BI.
What I want to know is to get the BI report and view name from the excel sheet so that I can do some modification in the report.
Please not the owner of the excel file is un-reachable.
Let say I have uploaded the sample Excel in the following URL http://www.fileflyer.com/view/VSHtOA8.
This excel file is pulling data from our BI Server
Could anybody tell me the report path, name and view name from the excel file
Regards
Mustafa -
How to find the event time segment details from delivery document
Hi,
In the delivery document at header level in Dates tab i have maintained begining Plan date where Event = Shipment.
But that field is in structure.
How to fetch those(Begining Plant Date) details in to report,
I have tried from Function module side also, i have not found any function module which is related to this field.
If any body give some solution, that will be great help for me.
Regards
LakshmikanthI have tried with those table(TSEGH & TSEGE), i have not found the begin plan date for that event. where event = shipment.
We are using 4.7 version. Here we have found one function module: TSEG_DIALOG_DATA, but iam unable to find the input details.
Here the input options are:
IF_HANDLE
IF_DIALOG_VIEW
IF_DIALOG_ZONE
May i know what are these inputs, what exactly i have to pass to this function module. -
How to find the Name of Infoset either from Query Name or Program Name
Hi,
I ahve got the program name from the Transaction code of the Query. I also found out the name of the Query but I could not find out the name of the "Infoset". Please help me to find out the name of the Infoset either from the Query Name or from the Program name.
Thanks,
JansHello Christian,
Thank you for your reply. Actually. We have got transaction name of report and from that we found out the name of the Program and from that Program we have utilised the FM to find out the Query name. But we are unable to find the name of Infiset as we have to Download this Infoset from DEV and it is to be uploaded into QUALITY.
But we are not sure about the Infoset.
I could not understand your sentence "When Open it".
Regards,
Jans -
How to find the code in standard transaction from where event is trigered
I have a configuration in SWEC, to trigger an event, when a PR is change
For the Transaction ME52 (Change Purchase requisition), I want to go to the portion of the code, from where the function module for triggering the event is executed.
I have learnt that F.Ms for trigerring events programatically are
1. SWE_EVENT_CREATE.
2. SWE_EVENT_CREATE_IN_UPD_TASK.
3. SWE_EVENT_CREATE_FOR_UPD_TASK
So, I tried debugging the transaction ME52 by setting breakpoints at the following function modules.
1. SWE_EVENT_CREATE.
2. SWE_EVENT_CREATE_IN_UPD_TASK.
3. SWE_EVENT_CREATE_FOR_UPD_TASK.
But none of these were encountered.Hi Sameer,
Why not follow the reverse approach! First check the event getting triggered and then move backwards to the source of triggering the event.
Activate event trace from SWELS and then check the event getting triggered in SWEL.
I doubt if putting break-points in the FM would help...
Check if the event is being triggered by the BO method.
You can check the where-used list of the method and find out the source of the event triggering.
Hope this helps!
Regards,
Saumya -
How to find the Size of a Folder &also list the sub folder and files in it
In my program I want to know the size of a folder . The input given is the path of the folder and the ouptut should be the list of files and subfolders with their size. What is the function we have to use for this?
Thank youclass: file
method: listFiles() - list all files of the dir referenced by the file object
method: length() - give the size of the file referenced by the file object ; you have to call this method on all file of the dir to make the sum and have the dir size -
How to find the cost center group from cycle/ segment in CO module?
Hi All,
I need to fetch the list of cost centers in the cost center group against the cycle.
Is there any table which will store the list of cost centers against the cycle?
or else, what I was thinking is use of BAPI BAPI_COSTCENTERGROUP_GETDETAIL, which will give me the list of cost centers,
but we need to pass the controlling area + cost center grp to fetch the cost centers from BAPI, I have controlling area with me but not the cost center grp name, only I have Cycle info lke cycle name, segment name, seq number. so how to find the cost center grp name from the cycle name?
Regards,
MrunalFM: RK_AL_CYCLE_READ
CHECK TABLE: T811K -
How to find the leave request layout in standard JavaWebdynpro ESS busi pac
Hi Gurus,
How to find the Intial leave request layout from the standard webdynpro ESS business package.
Can you tell me the exact component that i need to look for this particular layout.
Its a urgent requirement can you guys send me the answers ASAP
Higher points will be rewarded for the useful inputs.
Thanks in Advance,
Dharanicheck this ess~lea DC
xxxxxxxxxxxxxxxxxx
Edited by: Armin Reichert on Feb 18, 2008 7:12 PM -
How to find the leave request layout in standard Webdynpro ESS business pac
Hi Gurus,
How to find the Intial leave request layout from the standard webdynpro ESS business package.
Can you tell me the exact component that i need to look for this particular layout.
Its a urgent requirement can you guys send me the answers ASAP
Higher points will be rewarded for the useful inputs.
Thanks in Advance,
Dharanilook for ess~lea dc
reward points if helpful -
How to find the port # of OEM?
How to find the port # in the Oracle enterprise Manager URL (http://mydatabase:xxxx/em/). I have installed the Oracle long back did not jot down the URL. How to find the XXXX number in this case?
Oracle 10g R2.
Thank you,
Smithcheck following file in
$ORACLE_HOME/install
cat portlist.ini
iSQL*Plus HTTP port number =5560
Enterprise Manager Console HTTP Port (orcl) = 1158
Enterprise Manager Agent Port (orcl) = 3938
Maybe you are looking for
-
Helppppp!!!!!!
-
Autocorrect not working in InDesign CS5 - Help? :)
Hi there, To save time, I've set up autocorrect to insert repetitive phrases that I need in my documents by entering keystokes such as 'zz' and 'pp' etc. etc. Now, these autocorrect features work fine with a new document, however on the templates tha
-
Using Audio-line out in MacPro
Hi, I have recently switched to Mac from Windows. I have a good Altec Lansing speakers which I would like to continue using for sometime. Normally the speakers contains black and green connectors and you connect the green to the audio out. But connec
-
[JS CS5] ScriptUI: changing position of cursor in EditText control
Is there a way to change the position of the cursor in an EditText control? I've played around with the textselection property, but with no luck in getting the cursor between the right characters.
-
Pressing S doesn't start or stop automatic slide show in PowerPoint 2008
I have an automatic slide show created in PowerPoint 2008 which runs fine on PowerPoint 12.2.3 on a Mac running OS 10.5.8, but when running the same version of PowerPoint on 10.6.2, pressing the S and equal keys do not stop and start the presentation