而以下pattern则无法处理包含ExcludeString的独立行
^(.(?!stringToExclude))*$
To see a world in a grain of sand.
And a heaven in a wild flower
Hold infinity in the palm of your hand.
And eternity in an hour
一花一世界
一沙一天堂
掌中握无限
霎那成永恒
grep -P "\d{7}(\s+|:)(\d\d[\s+-]?){7}"
用来搜索同一个文本内的如下格式的数据:
2012083:04-09-14-15-26-33-04
2012084:02-10-20-26-28-29-14
2012103 11 14 32 33 02 09 04 14 11 33 32 364812438 452814888
If the configuration of the device (as defined by the Resources.Configuration class) changes, then anything displaying a user interface will need to update to match that configuration. Because Activity is the primary mechanism for interacting with the user, it includes special support for handling configuration changes.
Unless you specify otherwise, a configuration change (such as a change in screen orientation, language, input devices, etc) will cause your current activity to be destroyed, going through the normal activity lifecycle process of onPause(), onStop(), and onDestroy() as appropriate. If the activity had been in the foreground or visible to the user, once onDestroy() is called in that instance then a new instance of the activity will be created, with whatever savedInstanceState the previous instance had generated from onSaveInstanceState(Bundle).
This is done because any application resource, including layout files, can change based on any configuration value. Thus the only safe way to handle a configuration change is to re-retrieve all resources, including layouts, drawables, and strings. Because activities must already know how to save their state and re-create themselves from that state, this is a convenient way to have an activity restart itself with a new configuration.
In some special cases, you may want to bypass restarting of your activity based on one or more types of configuration changes. This is done with the android:configChanges attribute in its manifest. For any types of configuration changes you say that you handle there, you will receive a call to your current activity's onConfigurationChanged(Configuration) method instead of being restarted. If a configuration change involves any that you do not handle, however, the activity will still be restarted and onConfigurationChanged(Configuration) will not be called.
| 1 2 3 4 5 6 7 | <activity android:name=".SomeActivity" android:label="@string/app_name" android:configChanges="orientation"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter></activity> |
Resources.getSystem().getString(android.R.string.somecommonstuff)