What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » searching some letters or words in sentence...

searching some letters or words in sentence...
Author: Message:
genesistr
New Member
*


Posts: 6
Joined: Sep 2006
O.P. searching some letters or words in sentence...
hmm acctually i know how i must write the code but i dont know how i can do this...

a="hello";

how can i split this into letters... i mean in C.. its like this...
a[]="hello";
and i can call which one i want...
like a[2]=? ...
but in script i dont how can i...

exp...
word="this is an example";
search="an";

i want script to say "Word" include "search" or not...
09-19-2006 04:28 PM
Profile E-Mail PM Find Quote Report
mezzanine
Full Member
***

Avatar

Posts: 106
Reputation: 23
– / – / Flag
Joined: May 2005
Status: Away
RE: searching some letters or words in sentence...
This C code snippet will attempt to find the first occurence of needle in haystack. For reference, the strstr function returns a pointer to the first occurence of needle in haystack, or NULL if the needle is not found.

code:
#include <stdio.h>
#include <string.h>

main() {
char haystack[] = "This is our sentence";
char needle[] = "se";
if (strstr(haystack, needle)) printf("Found needle in haystack.");
    else printf("Not found.");
}


09-19-2006 05:09 PM
Profile PM Web Find Quote Report
Silentdragon
Full Member
***

Avatar
if(life==null && wrists) EmoAlert();

Posts: 148
Reputation: 2
34 / Male / –
Joined: Jun 2006
RE: searching some letters or words in sentence...
code:
var word = "this is an example";
if(word.match(/an/) != null){
        // contains an
}
09-19-2006 05:16 PM
Profile E-Mail PM Web Find Quote Report
genesistr
New Member
*


Posts: 6
Joined: Sep 2006
O.P. RE: searching some letters or words in sentence...
thx...
i can already write in C.. anyway thx..

and SilenDragon thx :) thats the wat i want...
09-19-2006 07:10 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On