Solved Checking if a string has some keywords

Discussion in 'Spigot Plugin Development' started by Ean244, Jun 5, 2017.

  1. i was trying to check if a string has some keywords that are sticked together
    example: I wanna find 'hel' in hello
    i tried using string#contains but it only finds the keywords if they are seperated
    example: I wanna find 'hel' in 'hello', it could not find it
    I wanna find 'hel' in 'hel lo', it could find it
    what should i do
     
    #1 Ean244, Jun 5, 2017
    Last edited: Jun 5, 2017
    • Like Like x 1
  2. ScarabCoder

    ScarabCoder Retired Resource Staff
    Retired

    Um, what?
    https://www.tutorialspoint.com/java/lang/string_contains.htm
    Finding "hel" in "hello" will return true. Finding "hel" in "hel lo" will return false. If you want to "skip over" spaces, replace all the spaces with nothing ("").
     
    • Agree Agree x 1
  3. Thanks for your help! solved:)
     
    • Friendly Friendly x 1