一个不使用任何字符串函数的示例程序 [英] one sample program without using any string function
本文介绍了一个不使用任何字符串函数的示例程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要编写一个函数来查找字母,例如在给定文本中找到的字母
公共布尔值(字符串文本,字符串valuetosreach)
{
}
值(rajesh,je);
请给我样品
i need to write a function to find the letter is found in the give text for example
public boolen value(string text,string valuetosreach)
{
}
value(rajesh,je);
pls give me sample
推荐答案
public static bool FindLetter (string text, char letter)
{
foreach (var c in text)
{
if (letter == c)
{
return true;
}
}
return false;
}
这篇关于一个不使用任何字符串函数的示例程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文