[ ZOSTROG @ 17.05.2006. 08:29 ] @
pomoc za pocetnika !! Da li se moze postaviti IF naredba za string.....tako da recimo pitam da li je poslednji karakter u stringu jednak recimo = # ... Zahvalan |
[ ZOSTROG @ 17.05.2006. 08:29 ] @
[ erkan @ 17.05.2006. 08:43 ] @
string ti je niz karaktera, naravno da mozes:
Code: if(imeStringa[imeStringa.Length-1] == '#') MessageBox.Show("DA"); else MessageBox.Show("NE"); evo jedan koristan link: http://www.braintique.com/csharp/chapters/03ch01.shtml [ sale83 @ 17.05.2006. 11:12 ] @
A u VB.NET
Code: Dim imeStringa As String = "String#" If imeStringa(imeStringa.Length - 1) = "#" Then MessageBox.Show("DA") Else MessageBox.Show("NE") End If ili Code: Dim imeStringa As String = "String#" Dim ch As Char = GetChar(imeStringa, imeStringa.Length) If ch = "#" Then MessageBox.Show("DA") Else MessageBox.Show("NE") End If ... Poz [ mmix @ 17.05.2006. 15:51 ] @
string ima i metod EndsWith
Code: Dim imeStringa As String = "String#" If imeStringa.EndsWith("#") Then MessageBox.Show("DA") Else MessageBox.Show("NE") End If [ Deep|Blue @ 17.05.2006. 20:39 ] @
ili funkcija right
Code: if strings.right("bla bla",1) = "#" then Copyright (C) 2001-2025 by www.elitesecurity.org. All rights reserved.
|