Project/SMI
[C#] String속성 : LastIndexOf
빡썽
2010. 12. 4. 16:50
string[] stringArray = new string[20];
private void AgeEatCheck()
{
int iDeleteCount = 0;
int AgeMin = 12;//초등학교 6학년
int AgeMax = 60;
private void AgeEatCheck()
{
int iDeleteCount = 0;
int AgeMin = 12;//초등학교 6학년
int AgeMax = 60;
for (int i = 0; i < listBox1.Items.Count; i++)
{
stringArray[i] = (string)listBox1.Items[i];//리스트박스의 아이템을 string배열에 담는다.
if (GetAge < AgeMin || GetAge > AgeMax)
{
int temp = stringArray[i].LastIndexOf('*'); //*있는 문자열의 인덱스
if (temp > 0) //*가 들어있는 문장은 양수로 나온다(없을경우 -1)
{
listBox1.Items.Remove(listBox1.Items[i]); //*있는 해당 문자열을 제거
iDeleteCount++; //몇개가 제거 되었는가? count 변수
}
}
}
if (GetAge < AgeMin || GetAge > AgeMax)
{
string sTemp = Convert.ToString(iDeleteCount); // int -> string 형변환
MessageBox.Show( sTemp + " : disable");
}
}
{
stringArray[i] = (string)listBox1.Items[i];//리스트박스의 아이템을 string배열에 담는다.
if (GetAge < AgeMin || GetAge > AgeMax)
{
int temp = stringArray[i].LastIndexOf('*'); //*있는 문자열의 인덱스
if (temp > 0) //*가 들어있는 문장은 양수로 나온다(없을경우 -1)
{
listBox1.Items.Remove(listBox1.Items[i]); //*있는 해당 문자열을 제거
iDeleteCount++; //몇개가 제거 되었는가? count 변수
}
}
}
if (GetAge < AgeMin || GetAge > AgeMax)
{
string sTemp = Convert.ToString(iDeleteCount); // int -> string 형변환
MessageBox.Show( sTemp + " : disable");
}
}