00001 #ifndef MATH_BITS_IMPLEMENTATION_FILE
00002 #define MATH_BITS_IMPLEMENTATION_FILE
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "math_bits.h"
00019
00020 #include <basis/istring.h>
00021
00022 istring crop_numeric(const istring &input)
00023 {
00024 istring to_return(input);
00025 for (int i = 0; i < to_return.length(); i++)
00026 if ( ( (to_return[i] >= '0') && (to_return[i] <= '9') )
00027 || (to_return[i] == '.')
00028 || (to_return[i] == '+') || (to_return[i] == '-')
00029 || (to_return[i] == 'E') || (to_return[i] == 'e') ) {
00030 to_return.zap(i, i);
00031 i--;
00032 } else break;
00033 return to_return;
00034 }
00035
00036 istring crop_non_numeric(const istring &input)
00037 {
00038 istring to_return(input);
00039 for (int i = 0; i < to_return.length(); i++)
00040 if ( ! ((to_return[i] >= '0') && (to_return[i] <= '9'))
00041 && (to_return[i] != '.')
00042 && (to_return[i] != '+') && (to_return[i] != '-')
00043 && (to_return[i] != 'E') && (to_return[i] != 'e') ) {
00044 to_return.zap(i, i);
00045 i--;
00046 } else break;
00047 return to_return;
00048 }
00049
00050
00051 #endif //MATH_BITS_IMPLEMENTATION_FILE
00052