开发者

Validate Strings to be of a exact "kind" (java)

My problem is that I cant make my string a valid one,

The valid way is this:

for example ---> "DP 3#4" this is a rule for a game, and i must validate it... I s开发者_开发百科earched for tokenizer, and even saving an array of char type, but after getting the chars in the array, i just can't work with it the way i want to.


Most (though not all) patterns like this can be easily checked using a Regular Expression. Take some time to learn how to build a Regular Expression that will be valid only for the valid pattern you're looking for. Then you should be able to use code like in these examples to check input against that pattern.


Use regular expressions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜