4 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
23 bool util::is_number(const char *value)
25 if (value == NULL || *value == 0)
29 if (*value < '0' || *value > '9')
37 bool util::is_hex(const char *value)
39 if (value == NULL || *value == 0)
45 if (value[1] != 'x' && value[1] != 'X')
51 if ((*value < '0' || *value > '9') &&
52 (*value < 'a' || *value > 'f') &&
53 (*value < 'A' || *value > 'F'))