Private Sub Text1_Change()
Dim a As String
Dim b As String
a = Label1.Caption
b = UCase(Text1.Text)
pos = InStr(a, b)
Label4.Caption = b & " first occurs in position " & pos
End Sub
如果,你是在C#中编写,方法都是差不多的
#include
#include
void main()
{
char ch;
printf("输入一个字母:");
scanf("%c",&ch);
if(ch>=97 && ch<=122)
{
ch=ch-32; //通过ASCII转换大小写
}
printf("转换成大写:%c \n",ch);
char a[50];
int i;
for(i=0;i
if(a[i]==ch)
{
printf("%c first occurs in position %d ",ch,i+1);
break;
}
}
//这儿最好再加个判断
if(i>=strlen(a))
{
printf("在字符串中不存在该字符");
}
}
啥编程语言啊?