Hi, I need to create a program to tell the position of the letters n and r in a word w/out using indexof, so I need to use word.substring, but for finding if the letter is in the word, I was thinking of using a variable, flag, as boolean to determine if a msgbox saying are you sure you want to continue would pop up, and I have not been able to get that part correct.
With my looking for both r and n process to say t or f for the flag, it thinks I'm converting n to boolean, but n is string. Is this how to do it, thx. Please help.
With my looking for both r and n process to say t or f for the flag, it thinks I'm converting n to boolean, but n is string. Is this how to do it, thx. Please help.
VB.NET:
[COLOR=#007f00]'look at flag
[/COLOR] [COLOR=#00007f]Do[/COLOR] [COLOR=#00007f]While[/COLOR] word.Substring(L, 1) <> "r"
L = L + 1
[COLOR=#00007f]If[/COLOR] word.Substring(L, 1) <> "r" [COLOR=#00007f]And[/COLOR] "n" [COLOR=#00007f]Then[/COLOR]
flag = [COLOR=#00007f]True[/COLOR]
[COLOR=#00007f]End[/COLOR] [COLOR=#00007f]If[/COLOR]
[COLOR=#00007f]Loop[/COLOR]
[COLOR=#00007f]If[/COLOR] flag = [COLOR=#00007f]False[/COLOR] [COLOR=#00007f]Then[/COLOR]
z = [COLOR=#00007f]MsgBox[/COLOR]("the word has no r or n. Quit? y/n", MsgBoxStyle.YesNo, "Quit?")
[COLOR=#00007f]If[/COLOR] z = 6 [COLOR=#00007f]Then[/COLOR]
[COLOR=#00007f]Me[/COLOR].[COLOR=#00007f]Close[/COLOR]()
[COLOR=#00007f]End[/COLOR] [COLOR=#00007f]If[/COLOR]
[COLOR=#00007f]End[/COLOR] If