Answer the question
In order to leave comments, you need to log in
There is a character string, in English. How can I replace all letters of the Latin alphabet with a "+" sign?
This string of characters, consisting of free
text in English, words separated by spaces. replace
all letters of the Latin alphabet with the sign "+". Input data using ListBox. strings are entered at the design stage of the form using the
properties
window .
Organize the output of the result in the label Label.
I have a code but I don't understand how to do everything as described above
Here is the code:
string alfEng = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz";//английский алфавит
char[] AA = alfEng.ToCharArray();
string stroka = "swer rrttyy uu iop!"; //исходная строка
string resultat = "";//здесь будет результат
stroka.ToCharArray().All(y=>{if(AA.Contains(y)) resultat+='+'; else resultat+=y; return true;});
Answer the question
In order to leave comments, you need to log in
possible through regehi
var input = "swer rrttyy uu iop!";
var result = Regex.Replace(input, "[a-z]", "+", RegexOptions.IgnoreCase);
Console.WriteLine(result); //++++ ++++++ ++ +++!
Discover ascii all english letters are numbers. Your task is to create a stringbuilder and iterate over the collection of characters in the source string. Inside the loop, check the character for entry into the range; if it is, then add it to the stringbulder + if not, then simply insert this character. I think this is the fastest way
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question