View Single Post
  #8 (permalink)  
Old 04-05-2007, 09:28 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 299
Karpagarajan is on a distinguished road
Thumbs up Re: Flash Tips & Tricks

Here is the tips to find a string in a given string. In action script, there is no function available like "instr()" in VB. to find a string we need to write a function like ..

function IsStr(SourceStr:String,FindStr:String):Number
{
var dumArr:Array=new Array();
dumArr=SourceStr.split(FindStr);
if (dumArr.length==1)
{
return -1;
}
else
{
var ActualStr:String=dumArr[0];
return ActualStr.length;
}
}

The above sample function will return a pos of the find string in the source string and if it is not found, then it will return -1.

hope it will be useful for you.

thanks
__________________
Karpagarajan. R
Necessity is the mother of invention

Last edited by Karpagarajan : 04-05-2007 at 09:46 AM.
Reply With Quote