alphabetical

Extracting whole words

时间秒杀一切 提交于 2019-11-26 16:55:17
问题 I have a large set of real-world text that I need to pull words out of to input into a spell checker. I'd like to extract as many meaningful words as possible without too much noise. I know there's plenty of regex ninjas around here, so hopefully someone can help me out. Currently I'm extracting all alphabetical sequences with '[a-z]+' . This is an okay approximation, but it drags a lot of rubbish out with it. Ideally I would like some regex (doesn't have to be pretty or efficient) that

What is a method that can be used to increment letters?

你说的曾经没有我的故事 提交于 2019-11-26 07:32:17
问题 Does anyone know of a Javascript library (e.g. underscore, jQuery, MooTools, etc.) that offers a method of incrementing a letter? I would like to be able to do something like: \"a\"++; // would return \"b\" 回答1: Simple, direct solution function nextChar(c) { return String.fromCharCode(c.charCodeAt(0) + 1); } nextChar('a'); As others have noted, the drawback is it may not handle cases like the letter 'z' as expected. But it depends on what you want out of it. The solution above will return '{'

How can I sort a List alphabetically?

霸气de小男生 提交于 2019-11-26 01:59:10
问题 I have a List<String> object that contains country names. How can I sort this list alphabetically? 回答1: Assuming that those are Strings, use the convenient static method sort… java.util.Collections.sort(listOfCountryNames) 回答2: Solution with Collections.sort If you are forced to use that List, or if your program has a structure like Create List Add some country names sort them once never change that list again then Thilos answer will be the best way to do it. If you combine it with the advice