Use the word existing in a sentence

  • Use the word existing in a sentences

Sentence Examples

The beginning of all physical activity is to compensate for existing damage. Do your children have a spinal column that is straight and strong?

This reconstruction of the film has been based on the only existing material.

Please allow me to give you this gift, the only existing portrait of Oliver Haddo, the magician.

Black people … existing for amusement as

And with the existing complications of his contract with the Society… the only solution seemed to be that I dispose of a few of the less valuable items… enough to pay part of his obligation to the doctor.

Until we entered this restaurant you had only been existing.

Ladies and gentlemen, I think that under existing circumstances the decisi├│n of this inquest must be that Sir Karell Borotyn met his death from cause or causes unknown.

This is indeed the happiest day of my life, as i realize That the forthcoming union of our houses Will strengthen forever the already existing friendship

Well, perhaps under the existing circumstances, madam—

He knows that no existing dynamo is capable to produce enough current to power your light system.

«Therefore, we find that we can’t consider your church «a well-recognized religious sect, «organized and existing, May 18, 1917.

My dear lady, that painting was the last existing canvas of my blue-green period.

That other person existing who cares as much about your interests as you do.

As a mere figment, as a mere ghost existing in your wife’s mind… I could hardly be said to have any business.

Exactly. Under existing restrictions, The vistaberg plants produce Nothing but kitchen utensils,

«This reconstitution of the original version of the «Drunkard» («O ├ëbrio») sought not only to respect the original intentions of the director but also to preserve the characteristics of the material then existing.

I’m tired of existing where one is neither hot nor cold, hungry nor full.

I’ll do my own thinking, thank you, and my own existing.

Now, what I am about to propose is no less than a radical and fundamental change… in the existing law.

Not many, only a few perhaps, but very definitely existing as we are here.

We’ve only one excuse for existing.

I’ve made a careful study of the existing contract… between the heirs of the late John Garrison and Lawrence white publishing enterprises.

The existing contract is valid, made in good faith.

It may flatter you to know that I have broken every existing record on my way from St. Petersburg.

Ancient settlements and missions no longer existing, ghost towns, ruins.

Based on existing documentation on the life and work German intelligence chief, Admiral Canaris.

Every existing thing, is here on purpose.

We can’t even produce enough of existing types of bombs, much less begin to work on something completely new and completely unpredictable.

And man, existing alone… seems himself an episode of little consequence.

For not following existing instructions about reporting to a flight surgeon after an accident.

The only known existing copy… is over 400 years old, you know.

As Colonel Kim has said, the history of all previous existing societies has been the history of the class struggle.

You see, you have to remember the existing conditions.

Excuse, but if you take 2 tiles from the 22 existing, where’s it goin’ to end?

Now, this is the first time that this has been mooted to the works committee, and everything about it constitutes quite definitely, quite definitely… a definite breach of the existing agreements that exist between management and unions.

I don’t know of one nation, whether existing now or in the past… that was not born in violence.

He can adapt it to any pre-existing reactor and so can transform again waves into light or devastating energy.

I feel a sort of difficulty existing.

I believe that if I go into court as myself… I can draw attention to the fault in the existing law.

None of the existing R-96’s are aware that they’re robots.

Our responsibility is to carry out existing orders.

My dear, with an administration which is still comprised of people who favored a law… ..that punished non-aryans with death, just for existing, or even for having sexual relations with aryans I’m not afraid at all of what would happen if they found Franz. No!

Only through the violent overthrow of all existing social order.

They are the negative and only existing work print of the producer’s just-completed six-million-dollar spectacle,

After today you will have broken every existing speed record. What are your future plans?

We are indebted to Timothy Ryan, bugler, 5th United States Cavalry… the company’s sole survivor, for his diary… the only existing record of this tragedy, and the campaign that followed.

I will perfect existing machines.

And the West German Federal Government has kindly agreed to make a further search of existing wartime records with a view to finally identifying this missile.

«Beloved nation of Katchumba, this visit is evidence of the ties existing between our States.»

who do not resemble with any existing operation, to avoid the puerility of ridiculous,

Random good picture Not show

1. The new design will eventually replace all existing models.

2. Calculations are based on a projection of existing trends.

3. Existing commercial broadcasters claim the new stations are illegal.

4. Existing laws on obscenity are to be tightened.

5. Existing methods of production are expensive and inefficient.

6. A loan was arranged to refinance existing debt.

7. The new system will be compatible with existing equipment.

8. The existing law is not wholly satisfactory.

9. We are looking to upgrade the existing facilities.

10. The existing wiring will have to be replaced.

11. Much of this business involves retrofitting existing planes.

12. The price of the house included many existing fixtures and fittings that were not to our taste.

13. Any new building must be fitted into the existing appearance of the city.

13. Sentencedict.com try its best to collect and make good sentences.

14. MPs called for tougher enforcement of the existing laws on drugs.

15. We are currently exploring new approaches within existing frameworks of practice and thinking.

16. Malcolm’s contract will run in tandem with his existing one.

17. Only children whose parents are existing savers may open an account.

18. The existing library is totally inappropriate to our needs.

19. A pro tem committee was formed from existing members.

20. Considerable modification of the existing system is needed.

21. Our future plans must mesh with existing practices.

22. This computer program can be integrated with existing programs.

23. She’s not living, she’s merely existing.

24. Strip off all the existing paint.

25. Much of our existing military hardware is obsolescent.

26. We’ll reorder when the existing stock is sold.

27. Existing houses are becoming totally unfit for human habitation.

28. The important thing is not to stop questioning. Curiosity has its own reason for existing.

29. The first chapter presents a critical review of the existing nursery education system.

30. We must encourage the planting of new trees and preserve our existing woodlands.

More similar words: distinguish, distinct, assist in, consist in, testing, distinction, distinctive, instinct, burst in, burst into, artistic, abstinence, clandestine, realistic, by this time, Palestinian, statistics, optimistic, voting, rating, statistical, setting, hunting, sophisticated, operating, exciting, creating, blotting, awaiting, parenting. 

1.
Advertising can take place on or off the Internet using newsletters, e-mail automation techniques, or by following leads that are provided by your existing customers


2.
At the same time, it is quite possible that we work with the new elements in such situations and strike new relationships, find new vocations and even change our existing view of life and its purpose


3.
was confirming the existing situation


4.
simply existing removed the possibility of nothing, but equally none of the


5.
Those willing to serve (that is at least two or more where are no existing elders) should then be put before the congregation for further consideration (since not all members may have suggested the same man/men)


6.
Despite the warmth of my feelings for The Kid I started to become emotionally numb, existing only when the wavelength of light changed or my nerves pinched my soul under Smiler’s latest onslaught


7.
There really was another human soul existing within the close-bounded universe of my island home


8.
So how do we avoid sublimating the word of God into the existing framework of our values and interests and not accommodate it to that?


9.
He, She or It has by simply existing removed the possibility of nothing, but equally none of the fundamental questions about beginning are answered by this God’s existence


10.
We can equip a hospital, or rebuild an existing one, if necessary, for you

11.
If that was the case, she would have come to the body with an existing identity, that was really the way she was acting


12.
That accomplished, he climbed the ladder and crept up on the roof where he had stacked corrugated metal panels, which so matched the existing roof as to have been perfectly camouflaged laying as they were


13.
“What you see before you, if you pretend the numbers we used to construct it aren’t there, is the one fragment left to us, which was in the depths of time, condensed into the symbol of all things existing


14.
have one group working out in the open and your existing


15.
It was the last week of August, he had trenched, laid pipe, fitted and made connections, run a drain to the existing out house, installed two pumps and a few fixtures, and was ready to test the system


16.
To see life continue, and nurtured towards goodness, that was both men’s sole reason for existing


17.
All existing systems are copies of a multitude of similar ones over all Universe


18.
be assigned to anyone that keeps the rules existing in


19.
Video is a great way to build a long-lasting relationship with your existing and


20.
harness their huge amount of existing traffic

21.
Existing customers are good affiliate candidates because they’re already


22.
Perhaps you need to bring the same sense of adventure into your existing relationship


23.
that we are opening up beyond existing pathways which are based on avoidance


24.
Carius could tell by the distance in her wide eyes that her dream had been a rare kind of nightmare — the kind that drew from existing horrors


25.
So, with the tears of the existing First Water


26.
Use 45 to 50 pages of existing content together with a $5 eBook cover from Fiverr


27.
The existing theories of concrete strength are divided into three groups: phenomenological, statistical and structural


28.
cope with the existing reality, while the envisioneer is


29.
The same would have happened to the existing beings called the human race, not too long ago


30.
have certain confirmation that there is an existing market for your products

31.
And, since the very act of existing within


32.
is very alike existing in a state of grace


33.
existing in a constant state of thanksgiving


34.
And wha t have we achieved other than a few modifications to those existing designs?’ Josh questioned, as he stared out through the shuttle’s window


35.
Sure, he knew there was temporal fracturing: pockets of time existing in a kind of uncertainty state, bits of the future and past breaking through, much like general quantum uncertainty but on a macro scale


36.
Though the value of what the artificer produces, therefore, should not, at any one moment of time, be supposed greater than the value he consumes, yet, at every moment of time, the actually existing value of goods in the market is, in consequence of what he produces, greater than it otherwise would be


37.
Torbin imagined them existing as a quantum system in its state of uncertainty: their existence would not bear scrutiny or objective observation, at least by the currently known means


38.
They were simply existing


39.
A species existing 250 light years away could have been transmitting radio signals for the last 249 years and they would not have reached your world as yet


40.
Some adherents hold that this view is supported by existing evidence in the natural world

41.
Moving up to higher levels of design, one also finds that the Bible contains additional design criteria within the already existing structural design


42.
The process I used to hide the code in a sentence is aimed at achieving one design goal (to create an ELS), and does not at all comply to any underlying numeric design or higher levels of design that may also exist in the sentence, as we find existing in the Bible


43.
Once inside the base, Raiya and Roidon were left with Zardino, who no longer trusted his own existing security measures


44.
existing wooden deck, then you are quite familiar with how the constant need for repair,


45.
decided to replace their existing wooden decks with vinyl


46.
easy accomplishment under the conditions existing by the end of


47.
The man who runs Belsen, Vince Brennan, wanted to spend their budget on improving living standards for the existing inmates – providing medical supplies, clean bedding, decent sized cells


48.
the promotional items at every existing Robo? It was a new idea,


49.
I also need to run this by an existing client of mine for any conflict of interest


50.
He would stop simply existing and start living

51.
‘It seems, though, we’ll need basic materials rather than fusing together existing technology


52.
That is not even existing


53.
It asked me for my existing phone number, and the area code I live in


54.
I didn’t have an existing number


55.
I told her that I had called the number and that they had asked for an existing number,


56.
The Red Cross, however, soon opened a relief depot, and finally many were housed in the coffee storehouses on the hillside, the residue existing as they might in the woods


57.
The solution to this unfortunate dilemma requires (the) reestablishing of and ―enforcement‖ of Immigration Quotas designed to preserve existing racial and ethnic balances (for the time being) while allowing recent arrivals an opportunity to properly assimilate into their new environment


58.
spiritual and intuitive limitations, ―understanding‖ what seems ―apparent‖ however mistaking its essential elements that remain hidden from (us) although existing within (us)………


59.
Marginalized communities existing on the (economic) ―fringe,‖ normally consisting of recent emigrants, although many such groups often include native born Americans, who, for a variety of reasons, have been unable to elevate themselves above the ―poverty‖ line, are oftentimes perceived or treated unfairly, as if their present social or economic standing were entirely owing to questionable value structures predisposing many to under achieve


60.
The sixties injected narrow and intolerant viewpoints, uninformed ideologies that sought shatter core-values and social customs by discrediting traditional conventions, unlike preceding generations that sought to establish their own unique identity within the conventional framework of existing social and cultural traditions

61.
…joined together for purposes of price-fixing, unlawful trade practices and restraint of trade…acquiring an unfair (―competitive‖) advantage over its market rivals…resulting in artificially higher prices than the consumer could (otherwise) afford to pay for (certain) products and services…not so a highly successful company that has carefully positioned itself in the open market…(properly) planning, researching, developing, designing, manufacturing, marketing, selling and distributing its products and services at a lower cost than its competitors while passing the savings along to its customers…these companies, having legally complied with existing laws and regulations, should not be penalized for their achievements…coerced into sharing their formulae for success with their (underachieving) competitors as the courts oftentimes mandate…


62.
There has been a disturbing tendency in recent years to categorically broaden (read: create more poor people) descriptive statistics designed to either support or reject existing assumptions relating to poverty rates that are oftentimes overstated, unreliable, unsupported by fact and likely to provide biased conclusions about poverty, its definition, extent, causes and prognosis for the future


63.
An individual may be aware of having achieved some contingent level of (material) competence in whatever manner, although an awareness of such competence oftentimes implies a presumption of knowledge based on reasonable evidence or what is otherwise assumed to be conditional knowledge because of the (existing) possibility of (potential) misunderstanding(s) or other faulty premise(s) that would otherwise call its absolute certainty into question


64.
God remains, of course, the ―Primary Mover‖ or ―First Cause‖ of the material universe; that is to say, God is/was not an initial event, that assumes pre-existing causal factors, but a ―Being‖ rather, existing outside the boundaries of external causes


65.
I understand that this is a difficult proposition from an American perspective indifferent, perhaps, to the hundreds of millions of people existing on this planet who either live or have lived in virtual bondage


66.
These tactics is not an indication of weakness or because they did not know any better but simply the best for the existing conditions


67.
A Perfect Being cannot ―cause‖ its own creation inasmuch as (the) subsequent effects of Creation imply an (existing) potential for movement or change and/or possessing a set of predicates or determinants otherwise lacking in a Perfect Being that is ―entirely without limit or incapable of any infallibility, whatsoever


68.
without regard to any one individual or group of individuals are not rightly considered criminal unless such actions otherwise ignore existing international covenants (established among nations during times of peace), governing acceptable rules of military


69.
Existing political tensions transcending the boundaries of American Society have steadily undermined America‘s fragile alliance with Europe in recent years


70.
Whatever has been eternally pre-ordained has (already) been revealed by Divine Wisdom inasmuch as anything existing in time

71.
eternal, some (future) event, perhaps, already exists, not (will) exist; that is to say, it exists in time as a pre-determined fact or in a manner that is understood within the capacious boundaries of timeless time as already existing


72.
Dickens was in every respect a man of conventional manners and tastes who sought to reform existing (societal) arrangements without (needlessly) upsetting the social fabric


73.
Perhaps it would be best leaving well enough alone rather than trying to revive memories that presently lie above and beyond the (present) timeline continuum; that is to say, existing somewhere beyond ―themselves,‖ in time


74.
With so much animosity existing in the world today, what can any of us hope for when (extreme) ―religious‖ types, professed followers of God‘s teachings, conduct themselves in such an uncharitable manner!


75.
Modern Society is in the throes of a revolutionary Revolt of Conscience; the solitary by-product of moral and intellectual parochialism that is gradually revealing itself in the vested self-interest(s) and manners of unbridled Individualism that has undermined equalitarian idealism, that once defined the national culture, by rendering every individual the sole arbiter of his or her own conscience and ensuing choices without giving proper pause to how such choices may otherwise impact, for better or for worse, other individuals or to a transcendent authority that each must (inevitably) be held accountable; that is to say, whose (social) consequences existing outside the provincial boundaries of that individual‘s (own) estate are no longer limited by (moral) restraint or prescribed rules of moral and ethical conduct but conditioned rather by circumventing designs contrary to the proportionate interests of a well-ordered society


76.
How to obtain that Justice is a tactical merry go round of Acts and Laws taken from all existing Law and thus the confusion in classification


77.
Why not simply enforce existing gun laws (already) on the books rather than proposing newer ones whose questionable impact on reducing gun related crimes are likely to produce diminishing results? Such political grandstanding, I suppose, plays well among certain audiences given to theoretical assumptions to critical questions that otherwise require practical solutions


78.
I‘m not certain, however, that adding new laws to re-enforce an over-whelming body of existing laws would necessarily achieve this desired result


79.
Anyhow, while searching the registry for all documents pertaining to the property, he made another discovery that was even worse: not only was the sale not registered, but the son-of-a-bitch hadn’t even researched to discover that there was an existing mortgage


80.
existing with the aid of the feeding tube

81.
The strategy was to use fictitious numbers most of the time, then pretend to be an existing squadron when appropriate


82.
Also you can experiment with the existing resistances which will change the sounds of piano


83.
“It’s a strange one, with controversial implications, and a hyper-sensitive dependence on existing conditions


84.
adapt existing games in such a way that everyone that


85.
Still the damage to the existing environment would have been similar, even if it had occurred over a longer time frame


86.
their existing limitations are and more importantly, learn the


87.
“What do you suppose will happen if they are successful in restricting job growth in Boulder, to go along with the existing residential restrictions?” Charles asked


88.
So, over a thirty-year period the foregone interest of giving up existing assets to pay for those appliances is much greater than the benefits of saved mortgage interest


89.
1,600 BC: between the Middle and New Kingdom dynasties), as was indicated by the many, rapid successions of pharaonic leadership, each of which was of extremely short duration, still would have made the effort to defend its existing foreign possessions


90.
The computer then drops algorithms that do poorly and adds potential competitors, rapidly calibrating and extending existing models

91.
We cannot begin to predict where people at even a small cocktail party will be located in five minutes, or who Dave will be hitting on! The existing models of social science, and I’m talking mostly about economics which is nearest to a ‘real science’ in terms of our methodology and approach, are very simplistic and fraught with large error terms


92.
complained about “dozens of other proposed and existing regulations including the agency»s plans to


93.
More so, I have received official letters in the last few weeks suggesting a likely Proceeding for confiscation of his abandoned personal assets in line with existing Laws by the bank in which my client deposited the sum of 13


94.
Paleontology (the science of the forms of life existing in former geological periods, as represented by fossil animals and plants) is another


95.
the difficulties faced by the industry when trying to improve existing refineries or when trying to build


96.
“Othman, third Caliph of the Moslems, had done away in 651–652 with all existing copies of the Koran except that of Abu Bekr [Bakr?], which itself was shortly afterward destroyed by Marwan, Governor of Medina


Improve Article

Save Article

Like Article

  • Read
  • Discuss
  • Improve Article

    Save Article

    Like Article

    Given a sentence as a string str and a word word, the task is to check if the word is present in str or not. A sentence is a string comprised of multiple words and each word is separated with spaces.
    Examples: 

    Input: str = “Geeks for Geeks”, word = “Geeks” 
    Output: Word is present in the sentence 

    Input: str = “Geeks for Geeks”, word = “eeks” 
    Output: Word is not present in the sentence 

    Approach: In this algorithm, stringstream is used to break the sentence into words then compare each individual word of the sentence with the given word. If the word is found then the function returns true. 
    Note that this implementation does not search for a sub-sequence or sub-string, it only searches for a complete single word in a sentence.
    Below is the implementation for the case-sensitive search approach: 

    CPP

    #include <bits/stdc++.h>

    using namespace std;

    bool isWordPresent(string sentence, string word)

    {

        stringstream s(sentence);

        string temp;

        while (s >> temp) {

            if (temp.compare(word) == 0) {

                return true;

            }

        }

        return false;

    }

    int main()

    {

        string s = "Geeks for Geeks";

        string word = "Geeks";

        if (isWordPresent(s, word))

            cout << "Yes";

        else

            cout << "No";

        return 0;

    }

    Java

    class GFG

    {

    static boolean isWordPresent(String sentence, String word)

    {

        String []s = sentence.split(" ");

        for ( String temp :s)

        {

            if (temp.compareTo(word) == 0)

            {

                return true;

            }

        }

        return false;

    }

    public static void main(String[] args)

    {

        String s = "Geeks for Geeks";

        String word = "Geeks";

        if (isWordPresent(s, word))

            System.out.print("Yes");

        else

            System.out.print("No");

    }

    }

    Python

    def isWordPresent(sentence, word):

        s = sentence.split(" ")

        for i in s:

            if (i == word):

                return True

        return False

    s = "Geeks for Geeks"

    word = "Geeks"

    if (isWordPresent(s, word)):

        print("Yes")

    else:

        print("No")

    C#

    using System;

    class GFG

    {

    static bool isWordPresent(String sentence, String word)

    {

        String []s = sentence.Split(' ');

        foreach(String temp in s)

        {

            if (temp.CompareTo(word) == 0)

            {

                return true;

            }

        }

        return false;

    }

    public static void Main(String[] args)

    {

        String s = "Geeks for Geeks";

        String word = "Geeks";

        if (isWordPresent(s, word))

            Console.Write("Yes");

        else

            Console.Write("No");

    }

    }

    Javascript

    <script>

    function isWordPresent(sentence, word)

    {

        let s = sentence.split(" ");

        for ( let temp=0;temp<s.length;temp++)

        {

            if (s[temp] == (word) )

            {

                return true;

            }

        }

        return false;

    }

    let s = "Geeks for Geeks";

    let  word = "Geeks";

    if (isWordPresent(s, word))

            document.write("Yes");

        else

            document.write("No");

    </script>

    Time complexity: O(n) where n is the length of the sentence.

    Auxiliary space: O(n) where n is the length of string.

    Below is the implementation for the case-insensitive search approach: 
     

    C++

    #include <bits/stdc++.h>

    using namespace std;

    bool isWordPresent(string sentence, string word)

    {

        transform(word.begin(),

                  word.end(), word.begin(), ::toupper);

        transform(sentence.begin(), sentence.end(),

                  sentence.begin(), ::toupper);

        stringstream s(sentence);

        string temp;

        while (s >> temp) {

            if (temp.compare(word) == 0) {

                return true;

            }

        }

        return false;

    }

    int main()

    {

        string s = "Geeks for Geeks";

        string word = "geeks";

        if (isWordPresent(s, word))

            cout << "Yes";

        else

            cout << "No";

        return 0;

    }

    Java

    import java.util.*;

    class GFG

    {

    static boolean isWordPresent(String sentence,

                                String word)

    {

        word = transform(word);

        sentence = transform(sentence);

        String []s = sentence.split(" ");

        for ( String temp :s)

        {

            if (temp.compareTo(word) == 0)

            {

                return true;

            }

        }

        return false;

    }

    static String transform(String word)

    {

        return word.toUpperCase();

    }

    public static void main(String[] args)

    {

        String s = "Geeks for Geeks";

        String word = "geeks";

        if (isWordPresent(s, word))

            System.out.print("Yes");

        else

            System.out.print("No");

    }

    }

    Python3

    def isWordPresent(sentence, word) :

        word = word.upper()

        sentence = sentence.upper()

        s = sentence.split();

        for temp in s :

            if (temp == word) :

                return True;

        return False;

    if __name__ == "__main__" :

        s = "Geeks for Geeks";

        word = "geeks";

        if (isWordPresent(s, word)) :

            print("Yes");

        else :

            print("No");

    C#

    using System;

    class GFG

    {

    static bool isWordPresent(String sentence,

                                String word)

    {

        word = transform(word);

        sentence = transform(sentence);

        String []s = sentence.Split(' ');

        foreach ( String temp in s)

        {

            if (temp.CompareTo(word) == 0)

            {

                return true;

            }

        }

        return false;

    }

    static String transform(String word)

    {

        return word.ToUpper();

    }

    public static void Main(String[] args)

    {

        String s = "Geeks for Geeks";

        String word = "geeks";

        if (isWordPresent(s, word))

            Console.Write("Yes");

        else

            Console.Write("No");

    }

    }

    Javascript

    <script>

    function isWordPresent(sentence,word)

    {

        word = transform(word);

        sentence = transform(sentence);

        let s = sentence.split(" ");

        for ( let temp=0;temp<s.length;temp++)

        {

            if (s[temp] == (word))

            {

                return true;

            }

        }

        return false;

    }

    function transform(word)

    {

        return word.toUpperCase();

    }

    let s = "Geeks for Geeks";

    let word = "geeks";

    if (isWordPresent(s, word))

        document.write("Yes");

    else

        document.write("No");

    </script>

    Time complexity: O(length(s))

    Auxiliary space: O(1)

    Method #3:Using Built-in Python Functions:

    • As all the words in a sentence are separated by spaces.
    • We have to split the sentence by spaces using split().
    • We split all the words by spaces and store them in a list.
    • We use count() function to check whether the word is in array
    • If the value of count is greater than 0 then word is present in string

    Below is the implementation:

    C++

    #include <iostream>

    #include <algorithm>

    #include <vector>

    #include <sstream>

    using namespace std;

    bool isWordPresent(string sentence, string word)

    {

        transform(word.begin(), word.end(), word.begin(), ::toupper);

        transform(sentence.begin(), sentence.end(), sentence.begin(), ::toupper);

        stringstream ss(sentence);

        vector<string> words;

        string w;

        while (ss >> w)

            words.push_back(w);

        for (const auto& w : words) {

            if (w == word) {

                return true;

            }

        }

        return false;

    }

    int main()

    {

        string s = "Geeks for Geeks";

        string word = "geeks";

        if (isWordPresent(s, word))

            cout << "Yesn";

        else

            cout << "Non";

        return 0;

    }

    Java

    import java.io.*;

    class GFG {

        static boolean isWordPresent(String sentence,

                                     String word)

        {

            word = word.toUpperCase();

            sentence = sentence.toUpperCase();

            String[] words = sentence.split(" ");

            for (String w : words) {

                if (w.equals(word)) {

                    return true;

                }

            }

            return false;

        }

        public static void main(String[] args)

        {

            String s = "Geeks for Geeks";

            String word = "geeks";

            if (isWordPresent(s, word))

                System.out.println("Yes");

            else

                System.out.println("No");

        }

    }

    Python3

    def isWordPresent(sentence, word):

        word = word.upper()

        sentence = sentence.upper()

        lis = sentence.split()

        if(lis.count(word) > 0):

            return True

        else:

            return False

    s = "Geeks for Geeks"

    word = "geeks"

    if (isWordPresent(s, word)):

        print("Yes")

    else:

        print("No")

    C#

    using System;

    public class GFG {

      static bool isWordPresent(string sentence, string word)

      {

        word = word.ToUpper();

        sentence = sentence.ToUpper();

        string[] words = sentence.Split(' ');

        foreach(string w in words)

        {

          if (w.Equals(word)) {

            return true;

          }

        }

        return false;

      }

      static public void Main()

      {

        string s = "Geeks for Geeks";

        string word = "geeks";

        if (isWordPresent(s, word))

          Console.WriteLine("Yes");

        else

          Console.WriteLine("No");

      }

    }

    Javascript

    <script>

    function isWordPresent(sentence, word){

        word = word.toUpperCase()

        sentence = sentence.toUpperCase()

        let lis = sentence.split(' ')

        if(lis.indexOf(word) != -1)

            return true

        else

            return false

    }

    let s = "Geeks for Geeks"

    let word = "geeks"

    if (isWordPresent(s, word))

        document.write("Yes","</br>")

    else

        document.write("No","</br>")

    </script>

    Output:

    Yes

    Time complexity: O(length(s))

    Auxiliary space: O(1)

    Like Article

    Save Article

    I have a string like The Password for the website is money, now if the string contains the word "money"then i have to mask the string like The Password for the website is XXXXX. The substitute XXXXX length should change based on the length of money i.e, if the string is The Password for the website is moneyyyyy then my output should be The Password for the website is XXXXXXXXX

    so far i tried like this

    string content="The Password for the website is money";
    string pattern = @"bmoneyb";
    string replace = "XXXXX";
    content = Regex.Replace(content, pattern, replace);
    

    But no result i even tried with string replace instead of regex but no use.
    Please help me out with this.

    asked Mar 10, 2017 at 10:56

    Meena's user avatar

    4

    You need to use a match evaluator with Regex.Replace and the regex to match any word with a key inside, like w*moneyw*:

    var content="The Password for the website is money and moneyyyy";
    var key = "money";
    var pattern = string.Format(@"w*{0}w*", Regex.Escape(key));
    var mask = 'X';
    content = Regex.Replace(content, pattern, m => new string(mask, m.Value.Length));
    Console.WriteLine(content);
    // => The Password for the website is XXXXX and XXXXXXXX
    

    See the C# demo

    The regex means:

    • w* — zero or more (* is a quantifier that matches zero or more instances of the quantified subpattern) word chars (letters, digits and _ symbol). NOTE you may tune this part to only match letters if you replace it with p{L}* (or if you only need ASCII, use [a-zA-Z]*.
    • money — the key, you might need to Regex.Escape it if there are special symbols inside
    • w* — see above.

    answered Mar 10, 2017 at 11:09

    Wiktor Stribiżew's user avatar

    Wiktor StribiżewWiktor Stribiżew

    601k37 gold badges427 silver badges539 bronze badges

    10

    Warning! OP added later that the password wasn’t at the end of the string. My answer will work only in this case. Feel free top go on :)


    Something like this?

    Demo on .Net Fiddle.

        var k = "The Password for the website is money";
        // we remove the noise
        var password = k.Replace("The Password for the website is ", "");
    
        // we add the noise and we use a string constructor to duplicate the letter.
        Console.WriteLine("The Password for the website is " + new string('X', password.Length));
    

    output:

    The Password for the website is XXXXX
    

    answered Mar 10, 2017 at 11:02

    aloisdg's user avatar

    aloisdgaloisdg

    21.8k6 gold badges87 silver badges101 bronze badges

    2

    I assume only password part in your text changes

    string content = "The Password for the website is monafsfasdey";
    Regex pattern = new Regex(@"bisbs(.*?)$");
    var match = pattern.Match(content);
    if (match.Success)
    {
        string replace = new string( 'X', match.Groups[1].Value.Length);
        content = pattern.Replace(content, replace);
    }
    

    answered Mar 10, 2017 at 11:05

    Liu's user avatar

    LiuLiu

    9528 silver badges19 bronze badges

    Понравилась статья? Поделить с друзьями:
  • Use the word display in a sentence
  • Use the word executive in a sentence
  • Use the word discuss in a sentence
  • Use the word excited in a sentence
  • Use the word disaster in a sentence