String 如何使用字母和数字反转字符串,以便仅提取字母
如何反转包含数字和字母的字符串,但我希望以相反的顺序输出字母。(不使用字符串函数)String 如何使用字母和数字反转字符串,以便仅提取字母,string,reverse,String,Reverse,如何反转包含数字和字母的字符串,但我希望以相反的顺序输出字母。(不使用字符串函数) 如果不使用索引切片或反向功能,可能会复制。请您更清楚地说明这个问题?请包括编程语言的标签,以获得更快速的答案。 string = 'Hellow 432' length = len(string) output = "" while length>0: output += string[length-1] length = length-1 print (output) String deta
如果不使用索引切片或反向功能,可能会复制。请您更清楚地说明这个问题?请包括编程语言的标签,以获得更快速的答案。
string = 'Hellow 432'
length = len(string)
output = ""
while length>0:
output += string[length-1]
length = length-1
print (output)
String details = "Hellow 432";
string numeric = "";
string nonnumeric = "";
char[] mychar = details.ToCharArray();
foreach (char ch in mychar)
{
if (char.IsDigit(ch))
{
numeric = numeric + ch.ToString();
}
else
{
nonnumeric =ch.ToString()+ nonnumeric;
}
}
return nonnumeric + numeric;
}