Find Any Character in String1 in String2

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Charles Law

    Find Any Character in String1 in String2

    I'm sure I will kick myself when you tell me, but is there a simple way to
    test for the existence of any character in string1 being present in string2?
    For example, if s1 = "abracadabr a" and s2 = "synonym" the result is false,
    but if s2 = "pelican" the answer is true.

    TIA

    Charles


  • Charles Law

    #2
    Re: Find Any Character in String1 in String2

    No matter, I have it: IndexOfAny

    I do have another question though: why is InvalidPathChar s incomplete under
    Windows? For example, it does not contain \ or /.

    Charles


    "Charles Law" <blank@nowhere. com> wrote in message
    news:%23%23uCez cyFHA.736@tk2ms ftngp13.phx.gbl ...[color=blue]
    > I'm sure I will kick myself when you tell me, but is there a simple way to
    > test for the existence of any character in string1 being present in
    > string2? For example, if s1 = "abracadabr a" and s2 = "synonym" the result
    > is false, but if s2 = "pelican" the answer is true.
    >
    > TIA
    >
    > Charles
    >
    >[/color]


    Comment

    • Dragon

      #3
      Re: Find Any Character in String1 in String2

      Hi,
      [color=blue]
      > I do have another question though: why is InvalidPathChar s incomplete[/color]
      under[color=blue]
      > Windows? For example, it does not contain \ or /.
      >
      > Charles[/color]

      Because "\" and "/" are valid path characters. 8=]

      "C:\TEMP\"

      Roman


      Comment

      • Dennis

        #4
        Re: Find Any Character in String1 in String2

        It's too bad (or at least I can't find it) an invalid chars for a file name
        within a path.
        --
        Dennis in Houston


        "Dragon" wrote:
        [color=blue]
        > Hi,
        >[color=green]
        > > I do have another question though: why is InvalidPathChar s incomplete[/color]
        > under[color=green]
        > > Windows? For example, it does not contain \ or /.
        > >
        > > Charles[/color]
        >
        > Because "\" and "/" are valid path characters. 8=]
        >
        > "C:\TEMP\"
        >
        > Roman
        >
        >
        >[/color]

        Comment

        • Charles Law

          #5
          Re: Find Any Character in String1 in String2

          Hmm...

          As Dennis says later, I too could not find a File.InvalidCha rs or
          Path.InvalidFil eChars method, so assumed that InvalidPathChar s must do the
          job. But, as you observe, it does not because \ and / are actually valid in
          a path.

          Notably, InvalidPathChar s also does not include * or ?, and yet these are
          not valid in a path. Perhaps that would have been a better example :-)

          Charles


          "Dragon" <no@spam.please > wrote in message
          news:OV3U23dyFH A.2540@TK2MSFTN GP09.phx.gbl...[color=blue]
          > Hi,
          >[color=green]
          >> I do have another question though: why is InvalidPathChar s incomplete[/color]
          > under[color=green]
          >> Windows? For example, it does not contain \ or /.
          >>
          >> Charles[/color]
          >
          > Because "\" and "/" are valid path characters. 8=]
          >
          > "C:\TEMP\"
          >
          > Roman
          >
          >[/color]


          Comment

          Working...