xref: /AOO41X/main/sal/rtl/source/strimp.c (revision 647f063d49501903f1667b75f5634541fc603283)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include "strimp.h"
25 
rtl_ImplGetDigit(sal_Unicode ch,sal_Int16 nRadix)26 sal_Int16 rtl_ImplGetDigit( sal_Unicode ch, sal_Int16 nRadix )
27 {
28     sal_Int16 n = -1;
29     if ( (ch >= '0') && (ch <= '9') )
30         n = ch-'0';
31     else if ( (ch >= 'a') && (ch <= 'z') )
32         n = ch-'a'+10;
33     else if ( (ch >= 'A') && (ch <= 'Z') )
34         n = ch-'A'+10;
35     return (n < nRadix) ? n : -1;
36 }
37 
rtl_ImplIsWhitespace(sal_Unicode c)38 sal_Bool rtl_ImplIsWhitespace( sal_Unicode c )
39 {
40     /* Space or Control character? */
41     if ( (c <= 32) && c )
42         return sal_True;
43 
44     /* Only in the General Punctuation area Space or Control characters are included? */
45     if ( (c < 0x2000) || (c > 0x206F) )
46         return sal_False;
47 
48     if ( ((c >= 0x2000) && (c <= 0x200B)) ||    /* All Spaces           */
49          (c == 0x2028) ||                       /* LINE SEPARATOR       */
50          (c == 0x2029) )                        /* PARAGRAPH SEPARATOR  */
51         return sal_True;
52 
53     return sal_False;
54 }
55