Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Find text in a string

Find text in a string

Scheduled Pinned Locked Moved C#
tutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hellamasta
    wrote on last edited by
    #1

    Hi, I'm building a text file filter. I need to verify if a string is part of another string, for example: I wanto to find if the word "text" is part of a string. I'm writing a class inherited by String class...is it the correct choice or already exists a class to do this? Sorry for my bad english;P

    J 1 Reply Last reply
    0
    • H hellamasta

      Hi, I'm building a text file filter. I need to verify if a string is part of another string, for example: I wanto to find if the word "text" is part of a string. I'm writing a class inherited by String class...is it the correct choice or already exists a class to do this? Sorry for my bad english;P

      J Offline
      J Offline
      J4amieC
      wrote on last edited by
      #2

      string myString = "Hello Text World"; int idx = myString.IndexOf("Text"); bool myStringContainsText = (idx>-1);

      H 1 Reply Last reply
      0
      • J J4amieC

        string myString = "Hello Text World"; int idx = myString.IndexOf("Text"); bool myStringContainsText = (idx>-1);

        H Offline
        H Offline
        hellamasta
        wrote on last edited by
        #3

        ....I'm a stupid!!! thanks!!!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups