mIRC Homepage
Posted By: silver2ksurfer Find the Longest Word in a String - 07/03/20 09:10 PM
Hi Community,

I search for Find the Longest Word in a String (Text)

search in String1-> This is a Sample for me and the Databasenetworkcontroller -> Find longest Word-> Databasenetworkcontroller
search in String1-> This is a Sample for the Databasenetworkmanager and me -> Find longest Word-> Databasenetworkmanager
search in String1-> the Sample for me and the Databasecontroller and all other users -> Find longest Word-> Databasecontroller

The Longest Word is on various Place and i want find and set to Variable.

Can anyone help me?

Big THX.
Posted By: Dazuz Re: Find the Longest Word in a String - 08/03/20 12:04 PM
Code
alias longestword {
  tokenize 32 $1
  while ($len($2)) tokenize 32 $iif($len($1) > $v1,$1,$2) $3-
  return $1
}


//echo -a $longestword(This is a Sample for me and the Databasenetworkcontroller)
Posted By: silver2ksurfer Re: Find the Longest Word in a String - 08/03/20 02:29 PM
thank you for fast Reply and nice script. works perfect.
© mIRC Discussion Forums