如何检查单词计数是否不存在? [英] How do I check to see if a word count doesn't exist?

查看:60
本文介绍了如何检查单词计数是否不存在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Visual Basic编写一个程序,用它来检查字符串的第一个单词,string.Substring(0,string.IndexOf())。它工作得很好,但我发现了一个简单的漏洞利用程序错误。如果输入的字符串只是一串没有任何字母的符号,那么它就会出错。我如何重写它以防止这种情况?谢谢! :D

解决方案

类似问题 [ ^ ]之前已被询问过。检查其中一个 [ ^ ]。



请参阅此提示:不要计算空格数字。 [ ^ ]

I'm writing a program in visual basic that uses this to check the first word of a string, " string.Substring(0, string.IndexOf(" ")) " . It works great, but I found an easy exploit that errors out the program. If the entered string is just a bunch of symbols without any letters, then it errors out. How would I rewrite it to prevent this? Thanks! :D

解决方案

Tons of similar questions[^] have been asked before. Check one of them[^].

Please, see this tip too: Don't count spaces when counting words.[^]


这篇关于如何检查单词计数是否不存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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