DataValueObject.object
上传用户:xiao730204
上传日期:2007-01-04
资源大小:141k
文件大小:2k
- <?php
- class DataValueObject extends BaseObject {
- Function DataValueObject() {
- $this->BaseObject( 'DataValueObject' );
- }
- Function ContainsChars( $string ) {
- return eregi( '[a-z]', $string );
- }
- Function ContainsNumbers( $string ) {
- return ereg( '[0-9]', $string );
- }
- Function ContainsSpecialChars( $string ) {
- $string = $this->StripChars( $string );
- $string = $this->StripNumbers( $string );
- if ( $string != '' ) {
- return true;
- }
- return false;
- }
- Function StripSpecialChars( $string ) {
- $string = eregi_replace( '[^a-z0-9]', '', $string );
- return $string;
- }
- Function StripChars( $string ) {
- $string = eregi_replace( '[a-z]', '', $string );
- return $string;
- }
- Function StripNumbers( $string ) {
- $string = eregi_replace( '[0-9]', '', $string );
- return $string;
- }
- Function IsNumeric( $string ) {
- if (
- ! $this->ContainsChars( $string ) &&
- ! $this->ContainsSpecialChars( $string ) &&
- $this->ContainsNumbers( $string )
- ) {
- return true;
- }
- return false;
- }
- Function StripToNumeric( $string ) {
- $string = $this->StripChars( $string );
- $string = $this->StripSpecialChars( $string );
- return $string;
- }
- Function IsOnlyChars( $string ) {
- if (
- $this->ContainsChars( $string ) &&
- ! $this->ContainsSpecialChars( $string ) &&
- ! $this->ContainsNumbers( $string )
- ) {
- return true;
- }
- return false;
- }
- Function StripToChars( $string ) {
- $string = $this->StripNumbers( $string );
- $string = $this->StripSpecialChars( $string );
- return $string;
- }
- }
- ?>