首页 \ 问答 \ C:从字符串中删除符号(C: Remove symbols from a string)

C:从字符串中删除符号(C: Remove symbols from a string)

我是否知道是否有办法从C中的字符串中删除非字母符号?

例如,我有一个char array[5][5]"hi", "my..", "name", "is,,", "bob!"

期望的输出: "hi", "my", "name", "is", "bob"

反正有没有删除符号?


May I know if there is any way to remove non-alphabetical symbols from a string in C?

For instance I have an char array[5][5] with: "hi", "my..", "name", "is,,", "bob!"

Desired output: "hi", "my", "name", "is", "bob"

Is there anyway to remove the symbols?


原文:https://stackoverflow.com/questions/11176336
更新时间:2023-12-14 09:12

最满意答案

小错误,可能是问题:

这个:

&all_flights_divid[1].flight_number,

应该:

&all_flights_divid[i].flight_number,
//                 ^

编辑:

此外,您读取了arrival_time_minute两次,而根本没有读取arrival_time_hour 。 修复它应该没问题。


Small mistake, that might be the problem:

this:

&all_flights_divid[1].flight_number,

should be:

&all_flights_divid[i].flight_number,
//                 ^

Edit:

Also, you read arrival_time_minute twice, and not reading arrival_time_hour at all. Fix it and it should be OK.

相关问答

更多
  • 小错误,可能是问题: 这个: &all_flights_divid[1].flight_number, 应该: &all_flights_divid[i].flight_number, // ^ 编辑: 此外,您读取了arrival_time_minute两次,而根本没有读取arrival_time_hour 。 修复它应该没问题。 Small mistake, that might be the problem: this: &all_flights_divid[1]. ...
  • scanf系列函数不能安全使用,特别是在处理整数时。 你提到的第一个案例特别麻烦。 标准说这个: 如果此对象没有适当的类型,或者如果转换的结果无法在对象中表示 ,则行为是未定义的。 干净利落。 你可能会想到%5d技巧等,但你会发现它们不可靠。 或者也许有人会想到errno。 scanf函数不需要设置errno 。 按照这个有趣的小页面 :他们最终完全抛弃scanf 。 所以回到你的C教授那问问他: C99究竟是如何要求sscanf报告错误的呢? The scanf family of function ca ...
  • 如果它只是扩展你的sscanf -approach,那么只需添加-+. -characters,并使用数据类型float或double ,它们可以表示浮点值: int main() { char * string = "xx=3300 rr=3.6 zz=-0.8"; float val; if(sscanf(string, "%*[^-+.0123456789]%f", &val)==1) printf("%f\n", val); else ...
  • if ($profitloss < 0) { echo "The profitloss is negative"; } 编辑 :我觉得这对于rep来说太简单了,所以这里有一些您可能会发现有用的东西。 在PHP中,我们可以使用abs()函数找到整数的abs() 。 例如,如果我试图弄清楚两个数字之间的区别,我可以这样做: $turnover = 10000; $overheads = 12500; $difference = abs($turnover-$overheads); echo "The ...
  • 很大程度上取决于你想象客户试图通过什么类型的论证。 如果它们传递的是整数,并且这个值足够大以保存要使用的值的范围,那么使用std :: size_t没有实际的好处 - 它不会执行任何操作,并且问题的表现方式因为一个显然很庞大的数字更容易混淆。 但是 - 无论如何,最好使用size_t,因为它有助于记录API的期望。 你显然不能对运行时生成的值进行“> 0”的编译时检查,但至少可以消除来自有意识的巨大数字ala的负面输入 template void f(T t) { if ( ...
  • 有一个称为“对象检测”的热点,试图做你想要的。 通常,您可以从任何图像甚至视频中检测任何内容(数字,人物,汽车等)。 最先进的技术大致分为两类: 更快 - RCNN ,它首先为您感兴趣的对象提出了许多候选窗口,然后检测这些窗口内的实际内容。 SSD只扫描图像一次并检测物体,与Faster-RCNN相比,速度更快但不可靠。 一个众所周知的实时物体检测方法是YOLO(You Only Look Once),它属于SSD类别,并且在这里有一个非常令人印象深刻的实时演示,为您提供物体检测感。 搜索这些方法的名称,您 ...
  • QTextStream提供了标准库流的等价物。 不要忘记,文本流应该在字符串之前销毁。 QString mystring = "67 49 213 59"; QTextStream myteststream(&mystring); int a = 0, b = 0, c = 0, d = 0; myteststream >> a >> b >> c >> d; QTextStream provides the equivalent of the standard library's streams. Do ...
  • 问题不在于扫描,而在于打印。 如果你使用这样的格式 printf("%02d", n); 零将确保有一个你想要的前导零 the problem isn't with the scanning, it's with the printing. if you use a format like this printf("%02d", n); that zero will make sure there is a leading zero like you want
  • 如果我在这里理解你,你就不再问为什么你的代码不起作用,而是如何让它更快。 这实际上是Project Euler寻找解决问题的有效方法的全部乐趣,因此请小心谨慎,首先考虑自己减少搜索空间。 我建议你让Haskell打印出三个列表pX p3,pX p4,pX p5,看看你是如何寻找一个循环的。 如果你像列表理解一样继续,你将从每个列表的第一个元素开始,1035,1024,1080。我很确定你会在选择1035和1024之后立即停止并且不测试任何值的周期P5,更不用说尝试涉及这两个数字的组合的所有排列。 (我还没有 ...
  • 你可以尝试这样的事情。 from BeautifulSoup import BeautifulSoup def getPrintUnicode(soup): body='' if isinstance(soup, unicode): soup = soup.replace(''',"'") soup = soup.replace('"','"') soup = soup.replace(' ',' ') ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)