如何使用LINQ从字符串中删除字符 [英] How to remove characters from a string using LINQ

查看:98
本文介绍了如何使用LINQ从字符串中删除字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个字符串



XQ74MNT8244A



要从字符串中删除所有 char



/ p>

748244



如何做?
请帮我做这个

解决方案

  new string(XQ74MNT8244A .Where(char.IsDigit).ToArray())==748244


I'm having a String like

XQ74MNT8244A

i nee to remove all the char from the string.

so the output will be like

748244

How to do this? Please help me to do this

解决方案

new string("XQ74MNT8244A".Where(char.IsDigit).ToArray()) == "748244"

这篇关于如何使用LINQ从字符串中删除字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆