![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Oct 2006
Posts: 19
Rep Power: 0
![]() |
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. 'look at flag
Do While word.Substring(L, 1) <> "r"
L = L + 1
If word.Substring(L, 1) <> "r" And "n" Then
flag = True
End If
Loop
If flag = False Then
z = MsgBox("the word has no r or n. Quit? y/n", MsgBoxStyle.YesNo, "Quit?")
If z = 6 Then
Me.Close()
End If
End If |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Feb 2006
Posts: 12
Rep Power: 0
![]() |
try this...
for L as integer = 1 to word.lenght
If word.Substring(L, 1) <> "r" And word.Substring(L, 1) <> "r" <> "n" Then
flag = True
End If
next
If not flag Then
z = MsgBox("the word has no r or n. Quit? y/n", MsgBoxStyle.YesNo, "Quit?")
If z = 6 Then
Me.Close()
End If
End If |
|
|
|
|
|
#3 | |
|
Expert Programmer
Join Date: Jun 2005
Posts: 852
Rep Power: 4
![]() |
Quote:
|
|
|
|
|
|
|
#4 |
|
Newbie
Join Date: Feb 2006
Posts: 12
Rep Power: 0
![]() |
yes
its a typing error. |
|
|
|
|
|
#5 |
|
Newbie
Join Date: Oct 2006
Posts: 19
Rep Power: 0
![]() |
I figured it out, I made a mistake, and didn't make the if's both = something.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Another CSS Issue | Lich | HTML / XHTML / CSS | 3 | Jun 29th, 2006 3:04 PM |
| Boolean operators?????? | SpaderS | C++ | 4 | Mar 20th, 2006 8:24 PM |
| Weirdness of -l compile flag | kurt | C | 8 | Nov 16th, 2005 12:44 AM |
| DOM (createElement issue...) | tempest | JavaScript and Client-Side Browser Scripting | 2 | Nov 1st, 2005 6:50 PM |
| JNDI and LDAP issue | Mortavitch | Java | 5 | Oct 20th, 2005 11:10 AM |