Results 1 to 2 of 2

Thread: searching for a word :)

  1. #1
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    51
    Posts
    934
    Rep Power
    109

    searching for a word :)

    good evening, have tried and built this little script and if you like it to search for a word, you can use it... theme: stringmanipulation, my 5 cent for today...

    [code=thinbasic]'-- lionhearts testscript for searching a word, part one, 11.april.2009

    uses "console", "UI"

    dim scoreahit as integer
    dim searchposition as integer
    dim textinfo as string
    dim searchword as string

    console_writeline ("-- to score a hit example, simple version --")
    printl

    textinfo = "superman batman hulk, spiderman superman batgirl, x-men superman robin, wolverine asterix obelix, superman incredible hulk mywoman"
    searchword = "superman"

    printl
    printl ("textpool is: " + textinfo)
    printl
    printl ("we are looking for: " + searchword)
    printl

    do
    scoreahit = instr(searchposition+1,textinfo,searchword)
    if scoreahit > 0 then
    printl "Position of searching word is: " & scoreahit
    end if
    searchposition = scoreahit + len(searchword) -1
    loop until scoreahit=0
    sleep 200

    console_writeline
    console_writeline ("ok, push a key to end this fantastic script")

    waitkey[/code]



    ciao, Lionheart
    Attached Images Attached Images
    Attached Files Attached Files
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  2. #2
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: searching for a word :)

    Nice example Lionheart. Few lines of code and it does quite a bit, the power of thinBasic!
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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