David Vallner
8/17/2006 10:12:00 PM
On Thu, 17 Aug 2006 23:55:05 +0200, fabsy <fabbyfabs@gmail.com> wrote:
> Aha! Yes it was something old.
> It opened the file with append..
>
> And, sorry for all the questions.. (im really trying to learn) :)
> But is there any thing like this in ruby?
>
> --VB code--
>
> If InStr(1, Text1.Text, "String to find", 1) > 0 Then Msgbox "I found
> the string!"
>
> --------
>
> ( If InStr(Start,String1,String2,CompareMode)>0 Then Msgbox "I found
> the string!")
>
>
Does VB index strings starting with 1?
For very simple seaching, use String#include?
>> "foobar".include? "ooba"
=3D> true
If you want to check if there's a substring to be found -after- (and not=
=
including) the second character, for example, then I'd use a substring:
>> "foobar"[2..-1].include? "ooba"
=3D> false
>> "foobar"[2..-1].include? "obar"
=3D> true
What VB's CompareMode is, I have no idea. Case sensitivity? If so, I'd =
personally manually use String#downcase in the conditional.
And, of course, there's always regular expressions, the swiss army knife=
=
of string searching, but those are for a longer discussion and you can =
probably find material for those out there that explains them rather =
nicely.
David Vallner