Ask a Question related to ASP, Design and Development.

  1. #1

    Default find in string

    How can i count the number of times a string appears within another string.
    Thanks a
    lot!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!
    !!


    Bite My Bubbles Guest

  2. Similar Questions and Discussions

    1. can't find string with quotes
      I'm trying to search for a string that contains quotes and my find statement keeps returning 0 even though I know the string exists in my...
    2. How to find second occurence of a string?
      Hi i am using the find function which will search the first occurence of a string. but how we can find the second or third ...occurence of the...
    3. Find and cut string
      Hi, I'm new to PHP, so please bear with me! =) Is there a nice little function to find a string between to html-tags? I.e. let's say I have a...
    4. [PHP] find string
      Isn't there an in_array function you can use? If (in_array($action, array(a1,a2,a3,a4)) { // do something } else { // do something else }
    5. find string between files
      Hi all, how can I search for a specific string inside a directory (between files) ? Thanks for your help
  3. #2

    Default Re: find in string

    Check out Regular Expressions.


    -dlbjr

    invariable unerring alien


    dlbjr Guest

  4. #3

    Default Re: find in string

    Manohar Kamath [MVP] wrote on 09 aug 2003 in
    microsoft.public.inetserver.asp.general:
    > Dim arElem
    > Dim myString
    > Dim mySubString
    >
    > myString = "this contains the word how many times just one time"
    > mySubString = "how many times"
    > arElem = Split(myString, mySubString)
    >
    > Response.Write("Number of times: " & UBound(arElem))
    The case insensitive way, often used by me:

    MyNum = UBound(Split(ucase(myString), ucase(mySubString)))
    Response.Write "Number of times: " & myNum

    This also does not keep a large array in memory, (I hope).

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan. Guest

  5. #4

    Default Re: find in string

    that;s a good one thanks
    "Manohar Kamath [MVP]" <mkamath@TAKETHISOUTkamath.com> wrote in message
    news:uCnZc0gXDHA.1280@tk2msftngp13.phx.gbl...
    > One way to do this is kinda a round about way. Use the Split function to
    > split the string into an array, and count the number of array elements,
    > minus one.
    >
    > Dim arElem
    > Dim myString
    > Dim mySubString
    >
    > myString = "this contains the word how many times just one time"
    > mySubString = "how many times"
    > arElem = Split(myString, mySubString)
    >
    > Response.Write("Number of times: " & UBound(arElem))
    >
    > You could also use the InStr function, and loop through the first ring to
    > count number of times the string appears.
    >
    > --
    > Manohar Kamath
    > Editor, .netBooks
    > [url]www.dotnetbooks.com[/url]
    >
    >
    > "Bite My Bubbles" <bmb@mybubbles.com> wrote in message
    > news:eT6gNQgXDHA.1620@TK2MSFTNGP12.phx.gbl...
    > > How can i count the number of times a string appears within another
    > string.
    > > Thanks a
    > >
    >
    lot!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!
    > > !!
    > >
    > >
    >
    >

    Bite My Bubbles Guest

  6. #5

    Default Re: find in string

    that's a good one too!

    "Evertjan." <exjxw.hannivoort@interxnl.net> wrote in message
    news:Xns93D264429E3CFeejj99@194.109.133.29...
    > Manohar Kamath [MVP] wrote on 09 aug 2003 in
    > microsoft.public.inetserver.asp.general:
    > > Dim arElem
    > > Dim myString
    > > Dim mySubString
    > >
    > > myString = "this contains the word how many times just one time"
    > > mySubString = "how many times"
    > > arElem = Split(myString, mySubString)
    > >
    > > Response.Write("Number of times: " & UBound(arElem))
    >
    > The case insensitive way, often used by me:
    >
    > MyNum = UBound(Split(ucase(myString), ucase(mySubString)))
    > Response.Write "Number of times: " & myNum
    >
    > This also does not keep a large array in memory, (I hope).
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)

    Bite My Bubbles Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139