Best Way to Check for same Word in string?

If I have an array of words, would the best way to check for the same word be to use 2 for loops?

Huh?
Sounds like homework...
What is a word? Presumably a String.
For equality of Strings you use...
    String s1 = ....
    String s2 =....
    if (s1 == s2) { equal depending on null case
    else if ((s1 != null) && (s1.equals(s2))) { equal }
For the case of checking one array to another....
      while items in array1
             get itema from array1
                  while items in array2
                       get itemb array2
                              is itemb equal (see above) to itema
                                     yes - then do something

Similar Messages

  • Best way to look for next char in String that is NOT "-" or " " or ","?

    I have a long String that is sent to me and needs to be parsed. Normally I can figure the end of the line by a line break, but sometimes the line break is lost only after the second line. This second line contains the characters:
    These characters can all appear any number of times. I will know I'm at the end of the line when I hit a character that is not one of those three. What is the best way to look for this? Is there an already set method in the Java API?
    Thanks for all the help!

    There are solutions using regular expression, eg; you can split string once a time using minus char, whitespace or comma:
    String tokens[] = anyString.split("\\-|\\x20|,");
    More sophisticated expressions could be done to achieve results:
    String re = "^(.+)(\\-|\\x20|,)(.)(.*)$";
    Matcher m = Pattern.compile(re).matcher(anyString);
    if (m.matches()) {
    String
    before = m.group(1),
    delimiter = m.group(2),
    firstCharAfterDelimiter = m.group(3),
    suffix = m.group(4);
    Regards.

  • I am getting pop ups on safari and firefox lately and am worried i may have malware or something now on my computer doing this. What is the best way to check this out for sure and remove it?

    I am getting pop ups on safari and firefox lately and am worried I may have malware or something now on my computer doing this. What is the best way to check this out for sure and remove it?

    Please review the options below to determine which method is best to remove the Adware installed on your computer.
    The Easy, safe, effective method:
    http://www.adwaremedic.com/index.php
    If you are comfortable doing manual file removals use the somewhat more difficult method:
    http://support.apple.com/en-us/HT203987
    Also read the articles below to be more prepared for the next time there is an issue on your computer.
    https://discussions.apple.com/docs/DOC-7471
    https://discussions.apple.com/docs/DOC-8071
    http://www.thesafemac.com/tech-support-scam-pop-ups/

  • What is the easiest way to check for internet connection in C#?

    Hi!
    I searched a lot but I didn't get my answer. I'm looking for the easiest way to check for internet connection. Can you help me?
    Thanks a lot.

    Hi Pouya Ebrahimzadeh,
    I suggest you could connect a site to check if it can be opened.
    Public Shared Function CheckForInternetConnection() As Boolean
    Try
    Using client = New WebClient()
    Using stream = client.OpenRead("https://msdn.microsoft.com/")
    Return True
    End Using
    End Using
    Catch
    Return False
    End Try
    End Function
    If you have any other concern regarding this issue, please feel free to let me know.
    Best regards,
    Youjun Tang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Best way to check whether the database is demo or sys?

    Hi Gurus,
    Whats the best way to check whether the installed peoplesoft database is a demo or a sys?
    Thanks for the help?
    Regards,
    Anoop

    There is nothing set by default.
    However, if it has been configured properly by the administrator after db creation, through the menu Peopletools>Utilities>Administration>Peopletools Options, the following query should return the type of the database :
    select systemtype from psoptions;Otherwise the following could help to understand what database you are on.
    From HRMS9.1 DMO database :
    SQL> select count(*) from ps_employees;
          2792From HRMS9.1 SYS database :
    SQL> select count(*) from ps_employees;
      COUNT(*)
             0Nicolas.

  • Best way to check boolean value

    Hi!
    I have a schema defining an XML element with a boolean attribute. The document related to this schema use true/false literal boolean values, eg:
    <myelement myattribute="false"/>....<myelement myattribute="true"/>
    The data is stored in binary xml storage.
    I query the db on the boolean attribute with an xpath condition like this:
    ..../myelement[@myattribute=false()]
    Querying the db with this method:
    SELECT XMLQuery('....' returning content) from dual
    all works as expected.
    Instead, using:
    SELECT XMLQuery('....' ' PASSING OBJECT_VALUE RETURNING CONTENT)
    FROM "myxmltable"
    WHERE XMLExists('....' PASSING OBJECT_VALUE);
    I get the error: ORA-31038: Invalid hexBinary value: "false"
    To get the second query method working, I have to change the xpath condition, forcing a string comparison:
    ..../myelement[string(@myattribute)="false"]
    Can someone explain me this behaviour? What is the best way to check a boolean value? I'd like to write the same xquery working in both methods!
    Thank you.
    Bye
    Mirko

    Hi Geoff
    here the schema:
    <xs:schema xmlns:tns="http://OracleTest" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified" targetNamespace="http://OracleTest" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="MyComplexType">
    <xs:sequence>
    <xs:element minOccurs="0" name="FirstChild">
    <xs:complexType>
    <xs:attribute name="A" type="xs:string" />
    <xs:attribute name="B" type="xs:string" />
    </xs:complexType>
    </xs:element>
    <xs:element minOccurs="0" name="SecondChild">
    <xs:complexType>
    <xs:attribute name="S" type="xs:string" />
    <xs:attribute name="B" type="xs:boolean" />
    <xs:attribute name="I" type="xs:integer" />
    </xs:complexType>
    </xs:element>
    <xs:element minOccurs="0" name="ThirdChild">
    <xs:complexType>
    <xs:sequence>
    <xs:element minOccurs="0" name="ThirdChildA">
    <xs:complexType>
    <xs:attribute name="A" type="xs:string" />
    <xs:attribute name="B" type="xs:string" />
    </xs:complexType>
    </xs:element>
    <xs:element minOccurs="0" name="ThirdChildB">
    <xs:complexType>
    <xs:attribute name="C" type="xs:string" />
    <xs:attribute name="D" type="xs:string" />
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    <xs:attribute name="ID" type="xs:string" />
    </xs:complexType>
    <xs:element xdb:defaultTable="MyElement" name="MyElement" type="tns:MyComplexType" />
    </xs:schema>
    and here two sample XML documents:
    <tns:MyElement ID="ID1" xmlns:tns="http://OracleTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://OracleTest http://OracleTest.xsd">
    <tns:FirstChild A="a" B="b" />
    <tns:SecondChild S="s" B="true" I="1" />
    <tns:ThirdChild>
    <tns:ThirdChildA A="aa" B="bb" />
    <tns:ThirdChildB C="cc" D="dd" />
    </tns:ThirdChild>
    </tns:MyElement>
    <tns:MyElement ID="ID2" xmlns:tns="http://OracleTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://OracleTest http://OracleTest.xsd">
    <tns:FirstChild A="aa" B="bb" />
    <tns:SecondChild S="ss" B="false" I="2" />
    <tns:ThirdChild>
    <tns:ThirdChildA A="aaaa" B="bbbb" />
    <tns:ThirdChildB C="cccc" D="dddd" />
    </tns:ThirdChild>
    </tns:MyElement>
    I registered the schema using Enterprise Manager. The "Show SQL" function returned this script:
    BEGIN
    DBMS_XMLSCHEMA.REGISTERSCHEMA(
    schemaurl => 'http://OracleTest.xsd',
    schemadoc => sys.UriFactory.getUri('/Testing/test.xsd'),
    local => FALSE,
    gentypes => FALSE,
    genbean => FALSE,
    gentables => TRUE,
    force => FALSE,
    owner => 'EMILIAROMAGNABUY',
    OPTIONS => DBMS_XMLSCHEMA.REGISTER_BINARYXML);
    END;
    This is my test script:
    -- This works fine: returns only the requested row.
    SELECT XMLQuery('declare default element namespace "http://OracleTest"; collection("/Testing")/MyElement/SecondChild[@B=true()]' returning content) from dual;
    -- This raises the error = SQL Error: ORA-31038: Invalid hexBinary value: "true"
    select xmlquery('declare default element namespace "http://OracleTest"; /MyElement/SecondChild[@B=true()]' passing object_value returning content).getclobval() from "MyElement";
    -- This doesn't work correctly: returns the requested row and two empty rows ?!? I don't like this cast, anyway.
    select xmlquery('declare default element namespace "http://OracleTest"; /MyElement/SecondChild[string(@B)="true"]' passing object_value returning content).getclobval() from "MyElement";
    Thank you
    Mirko

  • Configuration for consolidated check for same vendor from different company

    Hi All,
    My company is trying to print a single check for same vendor with same vendor number in multiple company code.
    The Automatic payment parameters has all company codes where the vendor is having open items.
    But when payment run is carried out and the check is printed, there are more than 1 check printed for the same vendor corresponding to the cleared invoices.
    One company is paying for all other companies and still multiple checks are printed.
    Can someone help with some lead to resolve this issue.
    Points will be assigned for helpful tips and answers.
    Thanks alot in advance

    Hi,
    i understood ur problem so dont worry.... solution is there in sap
    while confiqure automatic payment program in FBZP give paying company code payment transaction give company code what check through you want to pay that ....ofter that payment will go through this company code check only
    may be this information is useful to you

  • What is the best way to prepare for CERTIFICATION?

    what is the best way to prepare for CERTIFICATION?
    what is needed?
    where can i read more about it?

    Hi,
    Do as much as possible exercises based on your course material(which will be more than enough).
    If you know (some) Java and have understand the basics of OOP then this is enough for the exam.
    And do not forget:
    it is a multiple-choice test meaning that you see the possible answers.
    Either a single answer is correct (then you will have radio-buttons) or several answers are correct
    (then you will have checkboxes; in this case almost all questions will have more than one correct answer).
    You can refer to the topics for the certification
    https://websmp102.sap-ag.de/~sapidp/011000358700000499112003E
    Some links which might help
    /message/213564#213564 [original link is broken]
    /message/514469#514469 [original link is broken]
    /message/1315746#1315746 [original link is broken]
    /message/1736299#1736299 [original link is broken]
    /message/1736299#1736299 [original link is broken]
    /message/257122#257122 [original link is broken]
    /message/130164#130164 [original link is broken]
    /message/1916905#1916905 [original link is broken]
    /thread/167254 [original link is broken]
    /message/213564#213564 [original link is broken]
    /message/1315746#1315746 [original link is broken]
    <b>
    you try www.sapdoamin.com
    They provide Certification simulation questions which are veryuseful and a must try site.</b>
    Yes more questions comes on OOPS so get your OOPS concepts very clear.
    You don't need to do extensive coding in OOPS.
    Just get the concepts clear and i am sure the certification will be a cake walkthrough.
    All the best and good luck with your ABAP Accreditation.

  • Any way to check for errors in an external table besides the log?

    For example if you have an external table where a column is defined with a CHAR(1) but when you run a SELECT on it, the mapping comes up with trying to put a CHAR(2) into that single space. The only way I'm aware to see if something is wrong is to check the .log file. Is there any other way to check for an error message or count?
    I'm mounting external tables and copying data over to a 'holding' table to be able to work on the data before it's moved into the actual production table with PL/SQ code. If the stored proc can determine what rows are bad or missing or even that there just are some rows with problems then hand back to the app, it would greatly improve things.
    Thanks.

    No other way than to check for the existance of a .bad file, then have a look see at the .log then?

  • New MBP - Best way to care for battery?

    Not sure if this is necessary anymore, but I am receiving my new MBP in the mail later today. What is the best way to care for the battery? Should I plug the MBP into the wall for an amount of time before turning it on, or at least wait until it is fully charged before turning it on for the first time? Is anything like that even necessary anymore?
    Thanks,
    Keith

    Here's what Apple recommends:
    http://www.apple.com/batteries/notebooks.html
    Best use is frequently and lightly. Be sure to calibrate your battery every two months or so:
    http://docs.info.apple.com/article.html?artnum=86284
    Hope this helps...

  • Which Acrobat or Adobe product is best to subscribe to for converting Word files (all types) to pdf files and visa versa?

    Which Acrobat or Adobe product is best to subscribe to for converting Word files (all types) to pdf files and visa versa?
    Thank you!

    Probably PDF Pack: Reliably Create PDFs, Convert PDFs, & Merge PDFs Online | Adobe PDF Pack

  • My MacBook Pro is suddenly slower...is there an easy way to check for viruses?

    My MacBook Pro is suddenly slower...is there an easy way to check for viruses?

    OpsMgr have methods which can get all host classes. Here my own function which can solve your issue:
    function Get-SCOMClassProperty {
    param(
    [Microsoft.EnterpriseManagement.Configuration.ManagementPackClass]
    [Parameter(Mandatory = $true)]
    $ManagementClass,
    [Switch]
    [Parameter(Mandatory = $false)]
    $KeyOnly
    function Get-SCOMClassKeyProperty {
    param(
    $ManagementClass
    $ManagementClass.PropertyCollection | ? {$_.Key}
    If ($ManagementClass.Hosted) {
    Get-SCOMClassKeyProperty -ManagementClass $ManagementClass.FindHostClass()
    If ($ManagementClass.Base) {
    Get-SCOMClassKeyProperty -ManagementClass (Get-SCOMClass $ManagementClass.Base.Id)
    function Get-SCOMClassAllProperty {
    param(
    $ManagementClass
    $ManagementClass.PropertyCollection
    If ($ManagementClass.Base) {
    Get-SCOMClassAllProperty -ManagementClass (Get-SCOMClass $ManagementClass.Base.Id)
    $ManagementClassProperty = Get-SCOMClassKeyProperty -ManagementClass $ManagementClass
    If (!$KeyOnly) {
    $ManagementClassProperty += Get-SCOMClassAllProperty -ManagementClass $ManagementClass
    $ManagementClassProperty | Select-Object -Unique
    If you need to do it in SCOM 2007 R2 then you can try my scripts from this examples http://systemcenter4all.wordpress.com/2013/05/15/scom-monitoringclass-functions/. Last should work in 2007 R2 and in 2012. Example in thread will work only in 2012.
    For example just run command:
    New-SCOMManagementGroupConnection
    $ManagementClassName = "Microsoft.SQLServer.Database"
    $ManagementClass = Get-SCOMClass -Name $ManagementClassName
    Get-SCOMClassProperty -ManagementClass $ManagementClass -KeyOnly | select Name
    Vladimir Zelenov | http://systemcenter4all.wordpress.com

  • Custom IAC applications the best way to go for putting R/3 screens on web?

    Hi all,
    I am trying to figure out whether a Custom IAC would be a best way to go for putting custom developed R/3 transaction on the web. We want to put the R/3 transactions on the web but want to completely customize the look and feel of it. Is IAC the best way to go for it? will this work with any kind of transactions?
    cheer,
    i028982

    Hello,
    The ITS might not be the "best" way, but it sure would be an easy way.  If the transaction and screens are already created in the R/3 then you could just go to SE80 and create HTML templates to see if it will do what you want.  Steps:
    1. Transaction SE80
    2. Choose "Internet Service"
    3. Type in a custom developed z* name
    4. Right-click on the z* name and choose Create > Theme
    5. Create theme 99 (standard theme)
    6. Right-click on the z* name again and choose Create > Template
    7. Type in all information, theme number, program name and screen number.  Play with the "Generation Style" to see which one would better fit your transaction.
    After creating the screens you can publish to your ITS and give it a test.  Maybe this is all you need, if so, it would be fast and readily available.
    Best regards,
    Edgar Chuang

  • What would the best way to go for an virtual grid?

    I need a 3 x 8 virtual grid that I can change values to:
    Red
    Blue
    Spoiler
    what would the best way to go for this objective?
    Thanks!

    I need a 3 x 8 virtual grid that I can changevalues
    to:
    Red
    Blue
    Spoiler
    what would the best way to go for this objective?
    Thanks!Create a Grid and a Tile class. A
    Grid has a 2D array of Tile objects an
    a Tile has an attribute called Color and, say,
    an x- and y-point. Program some appropriate methods.
    Done.
    Thanks for trying, but Nanook already gave the correct answer in reply 1.Is it possible to restrict these? to like a 8 x 3 grid ?
    or should i use an if statement?

  • What is the best way to export for use on internet?

    what is the best way to export for use on internet?

    It depends. Is this for a personal web site or for a site like YouTube, Vimeo or Facebook?
    For YouTube, Vimeo and Facebook, use Publish & Share/Computer/AVCHD using one of the YouTube presets.

Maybe you are looking for